0

the code: the code

the output: the output

I just started learning c. So, I did a simple sum program.

The code looks like this...

Int main(void){
    Printf("enter numbers");
    Int n1,n2;
    Scanf("%d%d",&n1,&n2);
    Sum=n1+n2;
    Printf("sum= %d",sum);
}

when I build the program, there are no errors or warnings, but the console is empty. I can still type in two numbers and it gives the sum too.

33
66
enter numberssum=99

I want the entered number displayed when I hit run, not after finding the sum.

I use the eclipse ide for c&c++ 2020-06

double-beep
  • 5,031
  • 17
  • 33
  • 41
akishtp
  • 3
  • 4
  • 1
    Post the exact code you have along with the output and description of the problem. As of now, it's not clear. – Tarik Aug 15 '20 at 10:35
  • 1
    Are you certain that you have uploaded the right code? The program you have uploaded has syntactical errors and there is no way it should compile without errors and warnings in the present state. – WedaPashi Aug 15 '20 at 10:36
  • Please provide a [mre]. The shown code is not C (or you have omitted some very important declaratins and definitions. That and very likely also your immediate problem, can be solved by finding a HelloWorld program and studying it. – Yunnosch Aug 15 '20 at 10:37
  • 1
    The output in the terminal is "line buffered". It will only show if there is a '\n' in the output. – the busybee Aug 15 '20 at 10:55
  • The 'terminal' environment that Eclipse gives you isn't the same as the ordinary terminal environment. I'm not sure that there's a fix for it — if there was, it would be done automatically. – Jonathan Leffler Aug 15 '20 at 13:39

0 Answers0