A problem in an integer addition program in C
Posted: Mon Feb 17, 2014 6:19 pm
This is about a problem I encountered while trying to write an addition programm in C.
I will enclose every single detail happened inorder to make it easy for you, who are here in this forum, to understand where the actual error is.
IDE- CodeBlocks
Compiler- GNU GCC C compiler
OS- Windows 7 Home Premium 64bit
Below is the Source Code
When it is built and run within Code::Blocks it works perfectly but when I try to open it from the file where I saved it does not work properly.
It works up to taking the two integers as inputs and when I press the enter key the window suddenly disappears. This happens to every program that is written in this IDE in this computer.
Where can be the problem might be? Thanks in Advance
I will enclose every single detail happened inorder to make it easy for you, who are here in this forum, to understand where the actual error is.
IDE- CodeBlocks
Compiler- GNU GCC C compiler
OS- Windows 7 Home Premium 64bit
Below is the Source Code
Code: Select all
/*Integer addition Program*/
#include <stdio.h>
int main (void)
{
int integer1;
int integer2;
int sum;
printf("Enter First integer\n");
scanf("%d", &integer1);
printf("Enter Second Integer\n");
scanf("%d", & integer2);
sum = integer1+ integer2;
printf("Sum is %d \n", sum);
return 0;
}
It works up to taking the two integers as inputs and when I press the enter key the window suddenly disappears. This happens to every program that is written in this IDE in this computer.
Where can be the problem might be? Thanks in Advance