Explore a little.C ProgrammingC++HTMLVisual BasicSystem AnalysisE-CommerceBCA Notes
LEARN SOMETHING NEW

C++ Program to add two numbers

Read4BCA learning libraryFree access

C++ Program to add two numbers

//C++ Program to add two numbers
//header files
#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();
int a,b,sum;        //declaring variables
cout<<"Enter two numbers to add\n";
cin>>a>>b;        //getting integers
sum=a+b;
cout<<"Sum of two numbers:"<<sum;        //printing sum
getch();

}
//Now run the program by ctrl+f9

Output

C++ Program to add two numbers example

You can also see a video how to run this program

This lesson preserves the original Read4BCA material. Some programming examples use older tools and syntax. View original page.