Search



Saturday, 7 February 2015

Add

In this program, int a,b,c statement declares 3 variables named as a,b & c . The 2 values
are entered by user because of scanf statement & stored in a & b . Now, c variable 
stores the sum of a & b because of the statement c = a+b . Then the resulting sum is displayed on
screen using printf statement .
For more information & explanation of this program click here..  


Program to add two numbers.

#include<stdio.h>
#include<conio.h>
void main()
{       int a,b,c;
clrscr();
printf("program to add 2 variables");
printf("\n enter value of a : ");
scanf("%d",&a);
printf(" enter value of b : ");
scanf("%d",&b);
c = a+b;
printf("sum of a & b = %d",c);
getch();
}



No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.