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; }
9/29/2018 3:37:38 AM
Lakshman Patel7 Answers
New AnswerHi! 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; }
Because you haven't included printf function if you add printf ("%d",result); then it will show you output
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message