Sunday 28 December 2014

Cpp Program to perform Arithematic Operations


This is a very simple cpp program which performs the basic arithematic operations  addition , substraction , multiplication and division.


PROGRAM : 
#include <iostream>

using namespace std;

int main()
{
    float n1,n2,add,sub,mul,div;
    
    cout << "Enter 1st number: \t" ;
    cin>> n1;
    cout << "Enter 2nd number: \t" ;
    cin>>  n2;
    
    
     add= n1+n2;
     sub= n1-n2;
     mul= n1*n2;
     div= n1/n2;

    cout<<"\nSum is : \t" << add;
    cout<<"\nDifference is : " << sub;
    cout<<"\nProduct is : \t" << mul;
    cout<<"\nDivision is : \t" << div;
    
    return 0;
}
OUTPUT :

Cpp - Arithematic Operations