5 thích 0 k thích
110 đã xem

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++) - đã hỏi trong Introduction to Computer Programming I (C) bởi (9.9k điểm)
ID: 25997 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn

chọn từ khóa lại bởi | 110 đã xem
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.48
©2016-2024

Những câu hỏi liên quan

6 thích 0 k thích
2 trả lời
[Normal] Coding (C) - đã hỏi ngày 16 tháng 10 năm 2017 trong Introduction to Computer Programming I (C) bởi thopd (12.1k điểm)
ID: 27175 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 224 đã xem
12,783 câu hỏi
183,443 trả lời
172,219 bình luận
4,824 thành viên