We need to build a program that performs this algorithm:
Step 1: Read the values a,b,c,.
Step 2: Inside the try block check the condition.
a. if(a-b!=0) then calculate the value d=c/(a-b); and display.
b. otherwise throw the exception.
Step 3: Catch the exception and display the appropriate message.
Step 4: Stop the program.
Example input:
5 5 8
Output:
Answer is infinite because a-b is:0
Example input 2:
5 7 8
Output:
Result is:-4
Example input 3:
3 6 8
Output:
Result is:-2