Control Statements Conditional

58 programs in this topic — each includes source code, sample output and explanation.

  1. Check Positive Number

    This program checks if a number is positive using an if statement.

  2. Check Negative Number

    This program checks if a number is negative using an if statement.

  3. Check Even or Odd

    This program checks if a number is even or odd using if-else.

  4. Check Greater of Two Numbers

    This program finds the greater of two numbers using if-else.

  5. Check Age for Voting

    This program checks if a person is eligible to vote.

  6. Check Grade Based on Marks

    This program assigns grades based on marks using if-else ladder.

  7. Check Day Type (Weekday/Weekend)

    This program checks if a day is weekday or weekend.

  8. Check Month Name

    This program prints the month name based on a given number using switch.

  9. Check Grade Using Switch

    This program prints grade description based on grade character using switch.

  10. Check Largest of Two Numbers

    This program finds the largest of two numbers using nested if.

  11. Check Largest of Three Numbers

    This program finds the largest of three numbers using nested if.

  12. Check Leap Year

    This program checks if a year is a leap year using multiple conditions.

  13. Check Number Sign

    This program checks if a number is positive, negative, or zero.

  14. Check Eligibility for Scholarship

    This program checks eligibility for scholarship based on marks and income.

  15. Check Leap Year with Nested If

    This program checks if a year is a leap year using nested if statements.

  16. Check Largest of Four Numbers

    This program finds the largest of four numbers using if-else ladder.

  17. Check Pass or Fail

    This program checks if a student has passed or failed based on marks.

  18. Check Arithmetic Operation

    This program performs arithmetic operations based on user choice using switch.

  19. Check Course and Subject

    This program uses nested switch to print subject names based on course selection.

  20. Check Grading System with Ranges

    This program assigns grades based on marks ranges.

  21. Check Loan Eligibility

    This program checks loan eligibility based on income and credit score.

  22. Check BMI Category

    This program checks BMI category based on BMI value.

  23. Check Driving Eligibility

    This program checks driving eligibility based on age and license status.

  24. Check Season by Month

    This program prints the season name based on month number using a switch statement.

  25. Check Admission Eligibility

    This program checks admission eligibility based on marks and entrance exam score.

  26. Check Electricity Bill Slab

    This program calculates electricity bill based on units consumed using if-else ladder.

  27. Check Employee Department

    This program prints department name based on department code using switch.

  28. Check Discount Eligibility

    This program checks discount eligibility based on purchase amount and membership status.

  29. Income Tax Calculation

    This program calculates tax based on income slabs using if-else ladder.

  30. Check Scholarship Eligibility

    This program checks scholarship eligibility based on marks and extracurricular activities.

  31. Menu-Driven Calculator

    This program performs arithmetic operations based on menu choice using switch.

  32. Check Job Eligibility

    This program checks job eligibility based on age, qualification, and experience.

  33. Check Tax Category

    This program categorizes taxpayers based on income.

  34. Check Exam Eligibility

    This program checks exam eligibility based on attendance and marks using nested if.

  35. Refined Tax Category

    This program refines tax categories into more detailed ranges.

  36. Menu-Driven Food Ordering System

    This program simulates a food ordering system using switch.

  37. Check Insurance Eligibility

    This program checks insurance eligibility based on age, health status, and income.

  38. Check Travel Eligibility

    This program checks travel eligibility based on passport and visa status.

  39. ATM Withdrawal Check

    This program checks if withdrawal is possible based on balance.

  40. Online Shopping Discount

    This program checks discount eligibility based on purchase amount and membership.

  41. Exam Grading System

    This program assigns grades based on marks using if-else ladder.

  42. ATM PIN Verification

    This program checks ATM PIN and withdrawal eligibility using nested if.

  43. Banking Menu System

    This program simulates a banking menu system using switch.

  44. Check Loan Approval

    This program checks loan approval based on income, credit score, and employment status.

  45. ATM Transaction Options

    This program simulates ATM transaction options using if-else ladder.

  46. Online Shopping Menu

    This program simulates an online shopping menu using switch.

  47. Exam Result Classification

    This program classifies exam results based on marks and attendance using nested if.

  48. Nested Menu-Driven Application

    This program simulates a nested menu-driven application using nested switch.

  49. ATM Balance Inquiry

    This program checks and prints account balance.

  50. ATM Withdrawal with PIN

    This program checks PIN and withdrawal eligibility.

  51. Online Shopping Categories

    This program simulates online shopping categories.

  52. Exam Result Classification

    This program classifies exam results based on marks.

  53. Online Shopping Discount with Membership

    This program checks discount eligibility based on purchase and membership.

  54. Exam Grade Switch

    This program assigns grades based on grade character using switch.

  55. Tax Slab Calculation

    This program calculates tax based on income slabs.

  56. Loan Eligibility Check

    This program checks loan eligibility based on income and credit score using nested if.

  57. University Course Selection

    This program prints course name based on course code using switch.

  58. Travel Eligibility Check

    This program checks travel eligibility based on passport, visa, and ticket status.

Quick Links to Explore