C Program | SoloLearn: Learn to code for FREE!

+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; }

c

9/29/2018 3:37:38 AM

Lakshman Patel

7 Answers

New Answer

+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!

+2

ohh thanks i did really silly mistake

+2

Because you haven't included printf function if you add printf ("%d",result); then it will show you output

+1

No print... lol Keep learning!!!

0

where is your "printf ()"? you have to use it.

0

There is no print statementLakshman Patel