Breaking News

C++ Program To Add Two Numbers

This program will show u how to add two numbers in C++

There are many methods to add two numbers u can implement your logic also

Algorithm :

1.Start

2.Declare any to variables and get the input for them from the user

3.Declare another variable to store the result

4.After performing addition operation store the result into the new or 3rd variable created

5.Print The result

6.That's it two numbers are added.....!!!!!!

Program (Method  1):

#include<iostream.h>
#include<conio.h>
void main()
{
            int a,b,c;
            cout<<"Enter The Value Of A";
            cin>>a;
            cout<<"Enter The Value Of B";
            cin>>b;
            c=a+b;
            cout<<"Addition ="<<c;
            getch();
}

Program (Method 2):

#include<iostream.h>
#include<conio.h>
void main()
{
            int a,b;
            cout<<"Enter The Value Of A";
            cin>>a;
            cout<<"Enter The Value Of B";
            cin>>b;
            cout<<"Addition ="<<a+b;
            getch();
}

No comments