Add two numbers

1.Write a program to add two numbers?
#include
#include
{
int a,b,sum;
clrscr();
printf("enter the no.");
scanf("%d%d",&a,&b);
sum=a+b;
printf("result is %d",sum);
getch();
}


Algorithum
1.start
2.read two numbers a and b
3.calculate the sum =a + b
4.Print sum
5.stop

Result
Thus the program is sucessfully executed and the desired output is obtained.

output

enter the no.
1 2
result =3

0 comments:

Post a Comment