C++ Program To Subtract Two Numbers

This program will show u that how to subtract two numbers in c++

There are many methods to subtract 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 subtraction operation store the result into the new or 3rd variable created

5.Print The result

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

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();
}

C++ Program To Subtract Two Numbers C++ Program To Subtract Two Numbers Reviewed by Manish Jain on September 17, 2014 Rating: 5
Powered by Blogger.