/*Program for adding two numbers*/
#include <stdio.h>
int main(){
int a, b, sum; //declare the variables that will be used, a will store the first number, b second number and sum, the sum.
printf("Enter the first number:
"); //Prompts user to enter the first number.
scanf("%d", &a);//Accepts input and saves it to variable a
printf("Enter the second number:
");
scanf("%d", &b);
sum = a + b; //Formular to add the two numbers.
printf("Sum is %d", sum);
}
#include <stdio.h>
int addNumbers(int a, int b)
{
int sum = a + b;
return sum;
}
int main(void)
{
int a = 4;
int b = 7;
printf(addNumbers(a,b));
return 0;
}
#include <stdio.h>int main(){ int a, b, sum;printf("Enter two integers");scanf("%d %d", &a, &b);sum = a + b; printf("%d + %d = %d", a, b, sum);return 0;}