Answer to Question #184348 in C++ for Jingly

Question #184348

Design a program to read three integer numbers x, y and z and Evaluate arithmetic division for R, given R = z / (x - y). Use exception handling to throw an exception in case division by zero is attempted


1
Expert's answer
2021-04-22T14:10:36-0400
#include <iostream>


using namespace std;


int main()
{
    int x,y,z;
    double R;
    cout<< "Enter number X, Y, Z: ";
    cin>>x>>y>>z;
    if (x==y){
        cout<< " division by zero"<< endl;
    }
    else
        R=(double)z/(x-y);
    cout<<"R = "<<R;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS