Question: Write in C programming ! Write a program that reads a pollution scale value (integer) from the user and prints the corresponding pollution level. The
Write a program that reads a pollution scale value (integer) from the user and prints the corresponding pollution level. The pollution levels are shown below. To start with, decide whether it's better to use multiple if-statements or if-else statements. Your program should minimize the number of comparisons. What's the most efficient way of finding the right interval? High Medium Moderate-50 Low 80 70 s 50 This is a sample output. Enter the pollution scale value: 55 The pollution level is moderate. Validate the input at the start of the program. If the input is outside of the range [O-100), print the message shown below. After you print the error message, shut down the program immediately by calling the function: exit (1); Enter the pollution scale number: 101 Invalid input! Valid range is (0-100)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
