Add two number in c programming language - Math Traders

Latest

Add two number in c programming language

To add two numbers in c we make a very simple program and under this program we do following things.
  1. we have to declare to three variables in the program.
  2. we initiate the values of any two variable.
  3. now store the sum of these two variables in into the third variable.
the example of this program in c can be seen as:


#include<stdio.h>
#include<conio.h>
void main()
{

int a=5,b=6,sum;
sum=a+b;
printf("sum of two numbers is %d",sum);
getch();

}

output of this c program will be : 11

No comments:

Post a Comment