ProgramsJava

Module 2: Conditional Programs

if / else / switch. Grades, leap years, bills. The equal-to case is where it lies.

20 programs · open one, then the next

Start with Grade Calculator
  1. 01Grade CalculatorBeginnerCalculate grade based on percentage using conditional statements.Open example →
  2. 02Vowel or ConsonantBeginnerCheck whether a character is a vowel or a consonant.Open example →
  3. 03Check Alphabet/Digit/Special CharacterBeginnerCheck whether a character is an alphabet, digit, or special character.Open example →
  4. 04Check Leap YearBeginnerCheck whether a given year is a leap year.Open example →
  5. 05Check Armstrong NumberIntermediateCheck whether a number is an Armstrong number (sum of digits^number-of-digits equals the number).Open example →
  6. 06Check Perfect NumberIntermediateCheck whether a number is a perfect number (sum of proper divisors equals the number).Open example →
  7. 07Check Strong NumberIntermediateCheck whether a number is a strong number (sum of factorials of digits equals the number).Open example →
  8. 08Check Palindrome NumberBeginnerCheck whether a number is a palindrome (same forwards and backwards).Open example →
  9. 09Max of 3 Using Nested IfBeginnerFind the maximum of three numbers using nested if statements.Open example →
  10. 10Electricity Bill CalculatorIntermediateCalculate electricity bill based on units consumed using slab rates.Open example →
  11. 11Menu-Driven CalculatorBeginnerImplement a simple calculator using switch-case based on user choice.Open example →
  12. 12Profit or LossBeginnerDetermine profit or loss based on cost price and selling price.Open example →
  13. 13Triangle Validity CheckBeginnerCheck if three sides can form a valid triangle using triangle inequality.Open example →
  14. 14Roots of Quadratic EquationIntermediateFind the roots of a quadratic equation ax^2 + bx + c = 0 using discriminant.Open example →
  15. 15Person Eligibility (Age Check)BeginnerCheck if a person is eligible to vote based on age.Open example →
  16. 16Library Fine CalculationIntermediateCalculate library fine based on number of days a book is overdue.Open example →
  17. 17Attendance Percentage CalculatorBeginnerCalculate attendance percentage and decide if a student is allowed to sit in exam.Open example →
  18. 18Temperature ClassificationBeginnerClassify temperature as cold, moderate, or hot using conditions.Open example →
  19. 19Discount CalculatorBeginnerApply discount based on purchase amount using conditional logic.Open example →
  20. 20Basic Authentication ProgramBeginnerCheck username and password against hardcoded values.Open example →