Monday, 30 March 2015

Contoh operator Aritmathic C++


# include <<iostream.h>>

# include <<conio.h>>

main()
{
int a=20,b=10,add1,sub1,multiply1,div1;

float x=30.25,y=25.30,add2,sub2,multiply2,div2;
clrscr();
cout <<"\n**************************";
cout <<"\n* OPERATOR of ARITMATHIC *";
cout <<"\n**************************";
cout <<"\n\n";
cout <<"\n a = "<<a <<", b = "<<b;
cout <<"\n x = "<<x <<", y = "<<y;
cout <<"\n";
cout <<"\n Adding...";
cout <<"\n===========";
add1 = a + b;
add2 = x + y;cout <<"\n a + b = " <<add1;
cout <<"\n x + y = " <<add2;
cout <<"\n Subtracting...";
cout <<"\n================";
sub1 = a - b;
sub2 = x - y;cout <<"\n a - b = " <<sub1;
cout <<"\n x - y = " <<sub2;
cout <<"\n Multiplying...";
cout <<"\n================";
multiply1 = a * b;
multiply2 = x * y;cout <<"\n a * b = " <<multiply1;
cout <<"\n x * y = " <<multiply2;
cout <<"\n Divide...";
cout <<"\n===========";
div1 = a / b;
div2 = x / y;cout <<"\n a / b = " <<div1;
cout <<"\n x / y = " <<div2;

getch();

}

No comments:

Post a Comment