8.6.13

Exercise Week-1: Variable, Datatype and Initialization

While visiting the below link, read carefully the full page. The source code page will contains both C and C++  Code  simultaneously.



Exercise-1:Adding Two Numbers








1 comment:

  1. # include
    using namespace std;

    FARJANA KAMAL KONOK
    201930701
    62 BATCH

    int main()
    {
    char op;
    float num1, num2;

    cout << "Enter operator either + or - or * or /: ";
    cin >> op;

    cout << "Enter two operands: ";
    cin >> num1 >> 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;
    }

    ReplyDelete

Comment Here