C Program to Add Two Numbers

C Program to Add Two Numbers

C Program to Add Two NumbersĀ  in c programming language. This is a simple program. In this way anyone can be understood. Here we will first create an example program and explain it. How does this work? How to make a program in C Programming?


#include<stdio.h>
#include<conio.h>
void main() 
{
   int num1, num2, add;
   clrscr();
   printf("\n Enter first number: ");
   scanf("%d", &num1);
   printf("\n Enter second number: ");
   scanf("%d", &num2);

   add = num1 + num2;
   printf("\n Sum of the entered numbers is: %d", add);
   getch();
}
 

Output

  1. You can see here. First of all the Header File Structure of the C Program has been created.
  2. After that Main() Function is written.
  3. int num1,num2 These variables have been created. In which the data is stored
  4. add is also a variable created. Whose value is num1+num2.
  5. printf(“addition = %d”,add); Here the value of add has been printed.
TOP