C Program

Object:-Write a Program to add integer in C


int main()
    int a, b, s;    
    printf("Enter two integers: ");
    // Two integers entered by user is stored using scanf() function
    scanf("%d %d", &a, &b);
    // sum of two numbers in stored in variable sumOfTwoNumbers
    s= a + b;
    // Displays sum      
    printf("%d + %d = %d", a, b, s);
    return 0;


Enter two integers: 25
25 + 35 = 60


  • In this program, user is asked to enter two integers. Two integers entered by the user is stored in variables a and b respectively. This is done using scanf()function.
  • Then, variables a and b are added using + operator and the result is stored in s.

You may also like: