How to write a program to add two numbers in C++ language
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int a,b,c;
cout <<"Enter two numbers to add\n";
cin >> a >> b;
c=a+b;
cout <<"Sum of the numbers = " << c << end1;
getch();
}
OUTPUT: -
Enter two numbers to add
8
5
Sum of the numbers = 13
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int a,b,c;
cout <<"Enter two numbers to add\n";
cin >> a >> b;
c=a+b;
cout <<"Sum of the numbers = " << c << end1;
getch();
}
OUTPUT: -
Enter two numbers to add
8
5
Sum of the numbers = 13


No comments:
Post a Comment