Learn C++ - Add 2 number with C++

In this Tutorial,  we will learn to Input 2 numbers and Add them , you should have basic knowledge of setting up and opening Turbo C ++ compiler



void main

int a,b,c;
cout<<"Enter First No.";
cout<<"Enter second No.";

cout<<"Sum of Two numbers is :"<<c;


  • After clrscr(); we have declared the type of Data that will stored in a,b and c. Here we are going to add 2 integer and there result should be in form of Integer. Therefore we have used :
    int a,b,c;  , It will take only integer value not decimal . To enable C++ to use Decimal replace int with float
  • After that we are commanding the program to get two number from User.  Program will calculate the Value and store the Value in variable c
  • After that we are asking the Program to Output the Value of C. 
  • You can use various operator instead of + , For e.g use - to subtract , / to divide  and * to multiply