Question: Write a program that takes two integers a and b and prints their addition, subtraction, multiplication, division and modulo. If the value of b is

Write a program that takes two integers a and b and prints their addition, subtraction, multiplication, division and modulo. If the value of b is zero, the program should not do the division or modulo because this will crash the program. Instead, the program does all the other operations and show an error message for the division and modulo, as in the second sample below

Write a program that takes two integers a and b and printstheir addition, subtraction, multiplication, division and modulo. If the value of b This is the code i write. when the denominator is zero error come up.

Enter integera: 6 Enter integer b: a-b-6-0-6 a*b = 6*0 = 0 a/b-Cannot divide by zero

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!