My issue
My code
#include <stdio.h>
int main() {
printf("Output:3+4", 3 + 4 );
printf("\nOutput:2+1", 2 + 1);
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone
#include <stdio.h>
int main() {
printf("Output:3+4", 3 + 4 );
printf("\nOutput:2+1", 2 + 1);
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone
Notice the ‘_’ in the code, it will give you a hint to what should be put there.
The problem statement is telling us to print output of (3+4) and (2+1) without any spaces in the same line. In C, to print an integer output, we use “%d”,(within quotes).
The expected code would be something like this;
#include <stdio.h>
int main() {
printf("%d", 3 + 4 );
printf("%d", 2 + 1);
return 0;
}
Compare both codes and see the difference, what your code does is to print the string **Output : 3+4" as is. But problem statement requires us to only print the result of (3+4) and (2+1), for which we need “%d”.