+ 3
C Program
when I run this program it gives no output, why?? #include <stdio.h> int main() { int a = 6; int b = 4; int c = 2; int result; result = a - b + c; // 4 result = a + b / c; // 8 result = (a + b) / c; // 5 return 0; }
7 Answers
+ 5
Hi! You need a function to generate the outputs: example "printf".
#include <stdio.h>
int main() {
int a = 6;
int b = 4;
int c = 2;
int result;
result = a - b + c; // 4
printf("The first result is %d\n",result); //here
result = a + b / c; // 8
printf("The second result is %d\n",result); //here
result = (a + b) / c; // 5
printf("The third result is %d",result); //here
return 0;
}
+ 3
No problem! đ You're welcome!
+ 3
Because you haven't included printf function if you add
printf ("%d",result);
then it will show you output
+ 2
ohh thanks
i did really silly mistake
+ 1
No print... lol
Keep learning!!!
0
where is your "printf ()"?
you have to use it.
0
There is no print statementLakshman Patel