Write a C program to add two integers

Write a C program to add two integers

Add Two Integers User Input:

#include <stdio.h>
int main(){
int first integer, second integer, Sum of integers;
printf(“Enter first integer: “);//entered by user//
scanf(“%d”, &firstinteger);//entered by user//
printf(“Enter second integer: “);
scanf(“%d”, &secondinteger);
Sum of integers = first integer + second integer;//using sum adding two integers//
printf(“Sum of %d and %d is %d”, first integer, second integer, Sum of integers);
return 0;
}

Output:

Enter first integer: 2
Enter second integer: 4
Sum=6

No Comments

Post a Reply