Friday, 20 February 2015

How to both add and subtract in C++

Program:

#include<iostream.h>
#include<conio.h>
void main( )
{
clrscr( );
int a,b,c,d,e,f;
cout<<"Enter any two numbers for addition ";
cin>>a>>b;
c=a+b;
cout<<"Sum = "<<c;
cout<<"Enter any two numbers for subtraction ";
cin>>d>>e;
f=d-e;
cout<<"Sub = "<<f;
getch( );

No comments:

Post a Comment