Recent

Comments

Follow us on Facebook

Saturday 11 November 2017

1) Press ‘ +‘ to add two numbers 2) Press ‘-‘ to subtract two numbers 3) Press ‘/’ to divide two numbers 4) Press ‘*’ to multiply two numbers



QNo1.
*********************************************************************************
                                                                Arithmetic  Operations                                                                                
*********************************************************************************
1)      Press  ‘ +‘  to add two  numbers
2)      Press  ‘-‘  to subtract two numbers
3)      Press ‘/’  to divide two numbers
4)      Press ‘*’ to multiply two numbers

*********************************************************************************
Enter ist  Number :
Enter 2nd Number:
Select arithmetic operator from menu:
Result of Addition/Subtraction/Multiplication/Division is:

i)                    Create Menu as given above
ii)                   Take input from user for two integers

iii)                 Using switch statement, perform operation on two numbers as specified by user

Programing code

# include <iostream>
using namespace std;

int main()

{
    char op;
    float num1, num2;
    cout<<"************************************************************************************************************************ ";
    cout<<" \n                               arthematic operation                                                                        ";
    cout<<"\n************************************************************************************************************************ ";

    cout <<"                              \n1)Press + to add number                                                                      ";

    cout<<"                               \n2)press - to subtract number                                                                 ";
    cout<<"                               \n3)press * to  multiple number                                                                ";
    cout<<"                                \n 4)press / to divided number                                                                ";
    cout<<"\n************************************************************************************************************************";
    cin >> op;
    cout << "Enter firt operands       =      : ";
    cin >> num1 ;
    cout<<"Enter second operands       =      : ";
    cin>> num2;

    switch(op)

    {
        case '+':
            cout << num1+num2;
            break;

        case '-':

            cout << num1-num2;
            break;

        case '*':

            cout << num1*num2;
            break;

        case '/':

            cout << num1/num2;
            break;

        default:

            cout << "Error! operator is not correct";
            break;
    }

    return 0;

}

0 on: "1) Press ‘ +‘ to add two numbers 2) Press ‘-‘ to subtract two numbers 3) Press ‘/’ to divide two numbers 4) Press ‘*’ to multiply two numbers"

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix.

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix. ...

propeller ads

PropellerAds