C Program to Print Addition of Two Numbers

Ex: Write a C program to print addition of two numbers. How to write a C program to print addition of two numbers. C program to print addition of two numbers.

Input from user:

Enter the number 1: 
10
Enter the number 2:
20

Expected Output:

Addition of two numbers is =30.





Step by step logic to print addition of two numbers:

1. First we will take two   Number's from user say    no1, no2.

2. After that we will perform addition of two numbers.

3. We will store this addition in third variable say no3

4. After that we will display Addition means no3 on the output screen.






Program:

#include<stdio.h>
void main()
{
      int no1,no2,no3;
      printf("Enter the number 1:\n");
      scanf("%d",&no1);
      printf("Enter the number 2:\n");
      scanf("%d",&no2);

     no3=no1+no2;
     
     printf("Addition of two numbers is = %d",no3);

}

Above program will show the following output:

C Program to Print addition of two numbers

No comments:

Post a Comment

If you have any doubts, please discuss here...👇