C tutorial - Write c program for addition of two integers numbers

Programming languages or concepts

C program to Add two integer:-
   Flowchart:-

     

 

     Algorithm:-

 Step 1. Start
 Step 2. Declare variable num1, num2 and total.
 Step 3. Read num1 & num2.
 Step 4. Add num1, num2  and assign the                       result to a variable total
 Step 5. Display total.
 Step 6. Stop.


C code for Addition of two numbers.
   

        #include <stdio.h>
int main()
{   int num1,num2,total;
    printf("Enter two numbers");
    scanf("%d %d",&num1,&num2);
    total=num1 + num2;
    printf("%d",total);
    

    return 0;
}
   
In this program, the user is asked to enter two integer number. Theses two numbers are stored in variable num1 & num2 resp.
  Addition ('+') operator add two numbers and the result is stored in "total" variable.



Recommended for you:-





close