5 like 0 dislike
97 views

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
[Normal] Coding (C++) - asked in Introduction to Computer Programming I (C) by (9.9k points)
ID: 25997 - Available when: Unlimited - Due to: Unlimited

retagged by | 97 views
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.43.174
©2016-2024

Related questions

6 like 0 dislike
2 answers
[Normal] Coding (C) - asked Oct 16, 2017 in Introduction to Computer Programming I (C) by thopd (12.1k points)
ID: 27175 - Available when: Unlimited - Due to: Unlimited
| 205 views
12,783 questions
183,443 answers
172,219 comments
4,824 users