Dec 16, 2011

Program : Using Arithmetic Operators

Program : Using Arithmetic Operators

Arithmetic Operators
There are mainly Four Arithmetic Operators in C++ i.e. are + , - , * & /. + for Addition , - for Subtraction , * for Multiply & / for Divide.



Check the Following Program :-


#include<iostream.h>
#include<conio.h>  // for getch()
int main()
{
float a , b; // define float variable
cout << "Enter 1st Number \n"; 
cin >> a; // take value in a variable
cout << "Enter 2nd Number \n";
cin >> b; //take value in b variable
cout << "Addition = " << a + b <<endl; /* Display Addition value of a & b variable*/
cout << "Subtraction = " << a - b <<endl; /* Display Subtracted value of a & b variable*/
cout << "Multiply = " << a * b <<endl; /* Display Multiply value of a & b variable*/
cout << "Divide = " << a / b <<endl; /* Display Divided value of a & b variable*/

getch();
return 0;
}


OUTPUT



0 comments:

Post a Comment