1

I am building a basic calculator in C using the eclipse IDE. when the code compiles nothing is shown in the output screen. after enter any two number in the output section it adds the two number and the program printf's text.

 #include<stdio.h>

int main() {
int a , b , sum;

printf("Enter first number:");
scanf("%d",&a);

printf("Enter second number:");
scanf("%d",&b);

sum = a+b;

printf("%d",sum);

    return 0;
}

empty output. the instructions taht ask the user to enter the number is not showing

the result after enter two number

B.Daddy
  • 21
  • 1
  • 6
  • You cannot jost compile. also need to link. The result is an executable file. Then you have to actually run that executable file. – user3629249 Aug 17 '20 at 00:19
  • I compiled/inked/run the executable file. This was the result: `Enter first number:1 Enter second number:2 3` – user3629249 Aug 17 '20 at 00:20
  • since the IDE is giving you a 'bad time', suggest inserting `fflush( stdout );` after each call to `printf()` – user3629249 Aug 17 '20 at 00:23
  • @user3629249: after build/run in Eclipse, I see the SAME issue. The link from the first comment can help, and `fflush` is but one of suggested options in the accepted answer. – Paul T. Aug 17 '20 at 00:33

0 Answers0