Program to Add Two Integers in C

To add the two integers in C, you need three variables: two variables to store two different numbers and a third variable to store the sum of those two numbers.

Program

#include <stdio.h>

int main(void) {

   int a = 40;
   int b =10 ;

   printf("first number is %d ", a );
   
   printf("second number is %d ", b);



   int sum = a + b;

   printf("sum of two numbers is %d" , sum);

   return 0;
}

Output

first number is 40 
second number is 10 
sum of two numbers is 50

Leave a Comment