Addition of 2 Numbers: C++


This video tutorial illustrates a simple program of adding two integer numbers.

Full Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<iostream .h>
#include<conio .h>
 
void main()
{
 
 int a, b;
 clrscr();
 
 cout< <"Enter two no\n";
 cin>>a>>b;
 
 int sum = a + b;
 
 cout< <endl<<"Sum is: "<<sum;
 
 getch();
 
}

We can declare variables anywhere in a cpp program.

Video Tutorial: Addition of 2 Integer Numbers


[youtube https://www.youtube.com/watch?v=GBbOJZLkBBA&ap=%2526fmt%3D22]

YouTube Link: https://www.youtube.com/watch?v=GBbOJZLkBBA [Watch the Video In Full Screen.]



In this program we take input from the user, add it and then echo the result back to the screen.

Output
Enter two no
100
200

Sum is: 300

Leave a Reply

Your email address will not be published. Required fields are marked *