My issue
My code
#include <stdio.h>
int main() {
int a = 50;
int b = 40 ;
int sum = 50+ 40;
int product = 50*40 ;
int quotient = 50/40;
printf("%d \n", sum);
printf("%d \n", product );
printf("%d ", quotient);
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone
@akankshanagdev
Instead of using constants directly, you could have used variables assigned to the constants. Also, I would suggest properly reading the problem statement first before attempting any solution.
In your code, value of a should have been negative fifty, ( -50 ), instead of fifty, which is causing wrong output.
You can refer to the code below for a better understanding.
#include <stdio.h>
int main() {
int a = -50 ;
int b = 40 ;
int sum = a + b ;
int product = a * b ;
int quotient = a / b;
printf("%d \n", sum);
printf("%d \n", product );
printf("%d \n", quotient);
return 0;
}