Sunday, 28 August 2011

Add two numbers

Q. Write a program to add two numbers?

Ans.

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,sum;
 clrscr();
 printf("Enter Numbers a and b : ");
 scnaf("%d%d",&a,&b);
 sum=a+b;
 printf("\nsum(a+b)=%d",sum);
 getch();
}

     Output of above program : 

Enter Numbers a and b : 100
200

sum(a+b)=300

No comments:

Post a Comment