In our daily life also we take alternate decisions to satisfy conditions such as should we go for purchasing a laptop, desktop, or tablet based on the budget/specifications of a device/application. In C++ language, we take the help of multiple ifs to tackle such a problem.
The syntax of multiple ifs is shown in Figure.
Programs on multiple ifs are as follows.
5.4 Write a program to enter the percentage of marks obtained by a student and display the class obtained.
5.5 Program to display whether an entered character is in upper case, lower case, or not an alphabet.
Explanation: The program prompts the user to enter an alphabet. In case an uppercase letter is entered, the first if statement is executed, otherwise, for lowercase letters the second if statement is executed. For digit entry the third if is executed.