My issue
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int a = -50;
int b = 40;
int sum = -a+b;
int product = -a*b;
int quotient = a/b;
cout<<sum<<endl;
cout<<product<<endl;
cout<<quotient<<endl;
return 0;
}
Learning course: Learn C++
Problem Link: CodeChef: Practical coding for everyone
@gautamharshit9
Just a little mistake u don’t need to take -a in sum and product a is itself negative and by taking it as -a u r making it positive which would give wrong answer.
have corrected your code
include <bits/stdc++.h>
using namespace std;
int main() {
int a = -50;
int b = 40;
int sum = a+b;
int product = a*b;
int quotient = a/b;
cout<<sum<<endl;
cout<<product<<endl;
cout<<quotient<<endl;
return 0;
}