Sample addition program using C
June 25, 2010 Leave a comment
#include <stdio.h>
int main()
{
int x, y, sum;
printf(“Enter the first integer: \n”);
scanf(“%d”, &x);
printf(“Enter the second integer: \n”);
scanf(“%d”, &y);
sum = x + y;
printf(“The sum is : %d”, sum);
getchar();
return 0;
}
Sample Output:
Enter the first integer: 3
Enter the second integer: 4
The sum is: 7