Decision Making Statements (If Else)


  1. Two boxes contain different numbers written on them. The system checks whether both numbers are equal or not. If the numbers are different, their positions are exchanged; otherwise, they remain unchanged. Two numbers are input through the keyboard and the updated values are displayed on the screen.

  2. A manufacturing company designs two types of objects based on the radius provided by the customer. If the radius is smaller than 10 units, the object is treated as a circular plate and its area is calculated. Otherwise, the object is considered a cylindrical container, and its volume is calculated . the appropriate result should be displayed according to the condition.

  3. A company’s profit report may show either profit or loss at the end of the month. A positive value represents profit, while a negative value represents loss. A number is entered through the keyboard, and the financial status is identified and displayed on the screen.

  4. A telecom company prepares monthly mobile bills for its customers based on the number of messages sent and phone calls made. Different charges are applied according to usage limits. If the number of messages is less than or equal to 50, the charge is Rs. 0.10 per message; otherwise, Rs. 0.25 per message is charged. Similarly, if the number of calls is less than or equal to 200, the charge is Rs. 0.75 per call; otherwise, Rs. 0.95 per call is charged. A fixed monthly rent of Rs. 100 is also added to the bill. After calculating the bill amount, tax is applied at 12.5% if the bill is less than or equal to Rs. 1000; otherwise, tax is applied at 22.5%. The final gross bill is then displayed on the screen.

  5. A shopkeeper purchases products from a wholesaler and later sells them to customers at different prices. To know whether the business earned a profit or suffered a loss, the purchase price and selling price of an item are entered through the keyboard. The system then determines the type of transaction and displays the profit or loss amount on the screen.

  6. An electricity department generates monthly bills for households based on the number of electricity units consumed. Different rates are applied according to the unit slab. If the units consumed are less than or equal to 200, the rate is Rs. 2 per unit. If the units are less than or equal to 400, the rate becomes Rs. 3 per unit. If the units are less than or equal to 600, the rate is Rs. 4 per unit; otherwise, Rs. 5 per unit is charged. After calculating the bill amount, an additional 10% tax is applied to obtain the gross electricity bill, which is then displayed on the screen.

  7. A bank account monitoring system tracks the balance status of customer accounts. If the balance is greater than zero, the account is considered positive. If the balance is less than zero, it is considered negative due to overdraft. If the balance is exactly zero, it means no amount is available in the account. A number is entered through the keyboard, and the system displays whether the value is positive, negative, or zero.

  8. A shopkeeper buys different products from the market and later sells them to customers. Sometimes the selling price is greater than the purchase price, resulting in profit; sometimes it is lower, resulting in loss; and occasionally both prices are equal, resulting in neither profit nor loss. The purchase price and selling price are entered through the keyboard, and the system determines the type of transaction along with the corresponding amount before displaying the result on the screen.

  9. A calendar application used in a school needs to identify special years that contain 366 days instead of the usual 365 days. The year entered through the keyboard is checked according to calendar rules, and the system displays whether the given year is a leap year or not.

  10. A sports academy records the scores of four players in a competition. To select the top performer, the academy needs to determine which player has scored the highest marks among all four participants. Four numbers are entered through the keyboard, and the system identifies and displays the greatest value using nested if conditions.

  11. A school issues grades to students based on their academic performance in examinations. Students securing higher marks receive grade A, while others may receive grades B, C, or D according to their percentage range. The percentage of a student are entered through the keyboard, and the system determines and displays the appropriate grade using conditional operators.

  12. A talent competition is organized in a school where four participants receive different scores from the judges. To announce the winner, the organizers need to determine the highest score among all four participants. Four numbers are entered through the keyboard, and the system identifies and displays the greatest number using conditional operators.