Monday, 29 September 2014

ASSIGNMENT : 1 (PROGRAM TO DEMONSTRATE USE OF ARITHMETIC OPERATORS)

//            ASSIGNMENT  :  1
//            PROGRAM TO DEMONSTRATE USE OF ARITHMETIC OPERATORS
//            +   -   *   /   %

#include<iostream.h>
#include<conio.h>

void main()
{
                int a, b, c;
                float x;
                clrscr();
                a = 30;
                b = 7;

                c = a + b;
                cout<<"\n Addition of "<<a<<" and "<<b<<" = "<<c;

                c = a - b;
                cout<<"\n Substraction of "<<a<<" and "<<b<<" = "<<c;

                c = a * b;
                cout<<"\n Multiplication of "<<a<<" and "<<b<<" = "<<c;

                c = a / b;
                cout<<"\n Devision of "<<a<<" and "<<b<<" = "<<c;

                c = a % b;
                cout<<"\n Modulo of "<<a<<" and "<<b<<" = "<<c;

                getch();
}

//            OUTPUT
/*
 Addition of 30 and 7 = 37
 Substraction of 30 and 7 = 23
 Multiplication of 30 and 7 = 210
 Devision of 30 and 7 = 4
 Modulo of 30 and 7 = 2

*/

1 comment: