Add two numbers in C++?

In this section you will learn how to add two numbers in c++ in easy way. We are performing simple arithmetic operation on two numbers or addition of two numbers and then we will show the sum of two number on output screen. In this program we are taking the input from user.

Let’s suppose a user will input two numbers as '26' and '12' then as result 38 will be printed on the output screen.

How program will work?

Program of adding two numbers in c++


	#include<iostream.h>
	#include<conio.h>

	void main()
	{
		clrscr();
		int a,b,c;
		cout<<"ENTER THE FIRST NUMBER:- ";
		cin>>a;
		cout<<"\nENTER THE SECOND NUMBER:- ";
		cin>>b;
		c = a + b;
		cout<<"RESULT:- "<<c;
		getch();
	}

Output:


	ENTER THE FIRST NUMBER:- 26
	ENTER THE SECOND NUMBER:- 12
	RESULT OF TWO NUMBERS IS:- 38

Post Your Comment