The if-else-if ladder statement executes one condition from multiple statements. The execution starts from top and checked for each if condition. The statement of if block will be executed which evaluates to be true. If none of the if condition evaluates to be true then the last else block is evaluated.

Syntax:

if(condition_expression_One)
{
statement 1;
}else if (condition_expression_Two)
{
statement 2;
}else if (condition_expression_Three)
{
statement 3;
}else
{
statement 4;
}

#### Example Programs

Program [1]

Write a program to input an integer and check whether it is greater than 100, or less than 100 or equal to 100.

Program [2]

Write a program to input the Selling Price and Cost Price of a commodity and find the Profit or Loss made upon selling the product.

For example,

INPUT:

Enter the Selling Price of the commodity: 456

Enter the Cost Price of the commodity: 400

OUTPUT:

Profit: 56

INPUT:

Enter the Selling Price of the commodity: 300

Enter the Cost Price of the commodity: 310

OUTPUT:

Loss: 10

Program [3]

Write a program to check whether a int type number taken as input is a positive, negative or a zero.

Program [4]

Write a program to accept a mark obtained by a student in computer science and print the grades accordingly:

 Marks Grade Above 90 A 70 to 89 B 50 to 69 C below 50 D

Program [5]

A cloth showroom has announced the following festival discounts on the purchase of items, based on the total cost of the items purchased:

 Total Cost Discount (in Percentage) Less than ₹ 2000 5% ₹ 2001 to ₹ 5000 25% ₹ 5001 to ₹ 10000 35% Above ₹ 10000 50%

Write a program to input the total cost and compute and display the amount to be paid by the customer after availing the discount.

Program [6]

An electricity company charges their consumers according to the units consumed per month according to the given traffic:

 Units Consumed Charges Up to 100 units ₹ 2 per unit More than 100 units and up to 200 units ₹ 1.80 per unit More than 200 units ₹ 1.50 per unit

In addition to the above, every consumer has to pay ₹ 200 as Service Charge per month. Write a program to input the amount of units consumed and calculate the total charges payable (Bill) by the consumer.

Program [7]

A library charges a fine for books returned late. Following are the fines:

First five days : 40 paise per day.

Six to Ten days : 65 paise per day.

Above ten days : 80 paise per day.

Design a program to calculate the fine assuming that a book is returned N days late.

Program [8]

Write a program to input 3 unique integers and print the smallest among them