Write a C program that reads two integer values from the keyboard via the scanf function, then adds them together, stores the result into a variable called sum, and then prints out the value of the variable sum.
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
int num1;
int num2;
int sum;
printf("Please enter a number: ");
scanf("%d",&num1);
printf("Please enter a number: ");
scanf("%d",&num2);
sum = num1 + num2;
printf("\nResult: %d",sum);
return 0;
}