Subtracting Two Numbers in C++ Program:

Description:

In this post you can learn how you can Subtract two number easily by making a simple C++ program at Turbo C++ software. Turbo c++ make it easy for you to learn programming with in no time. Here you can learn how you can Subtract two integers easily by putting the codded program given you below.
Program Structure:



#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,sub;
cout<<"This is my second program"<<endl;
cout<<"Subtraction of two numbers"<<endl;
cout<<"First Number: ";
cin>>a;
cout<<"\nsecond number: ";
cin>>b;
sub=a-b;
cout<<"sub= "<<sub;
getch();
}

Explanation:

The whole program can be explained easily below in points.
  1. Void main() is the predefined function.
  2. Cout<< the command to show the desired text or result on screen.
  3. Int represents the integers which are a and b in this program.
  4. /n command to make the program to go to next line.
  5. #Include<iostream> directives to show results.
  6. Cin>> to add data by the user function.
  7. { } opening and closing boundary of the program body.

Post a Comment

 
Top