Saturday, 1 October 2016

Program to demonstrate arithmetic operators.

Program to demonstrate arithmetic operators.

//To demonstrate arithmetic operators.

#include<iostream.h>
#include<conio.h>
 void main( )
{
int a,b,s,p,d,r,div;
clrscr( );
cout<<"enter the value of a and b";
cin>>a>>b;
s=a+b;
d=a-b;
p=a*b;
div=a/b;
r=a%b;
cout<<"\n addition="<<s;
cout<<"\n subtraction="<<d;
cout<<"\n multiplication="<<p;
cout<<"\n division="<<div;
cout<<"\n remainder="<<r;
getch( );
}

Output.

Enter the value of a and b. e.g 10,3.

Addition = 13.

Subtraction = 7.

Multiplication = 30.

Division = 3.

Remainder = 1.


0 comments: