Skip to content

Instantly share code, notes, and snippets.

@nalin-adh
Created November 8, 2015 18:10
Show Gist options
  • Save nalin-adh/d0383b46be7ccaddeca9 to your computer and use it in GitHub Desktop.
Save nalin-adh/d0383b46be7ccaddeca9 to your computer and use it in GitHub Desktop.
A C++ program that reads two numbers and find sum, difference, product and division.
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
float a,b,sum=0.00,diff=0.00,pro=0.00,div=0.00;
cout<<"Number a = ";
cin>>a;
cout<<endl;
cout<<"Number b= ";
cin>>b;
sum=a+b;
diff=a-b;
pro=a*b;
div=a/b;
cout<<endl<<endl;
cout<<a<<" + "<<b<<" = "<<sum<<endl;
cout<<a<<" - "<<b<<" = "<<diff<<endl;
cout<<a<<" * "<<b<<" = "<<pro<<endl;
cout<<a<<" / "<<b<<" = "<<div<<endl;
getch();
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment