IF - Else Programming

IF - Else Programming

  1. Write a program to find the maximum between two numbers.
  2. Write a program to find the maximum between three numbers.
  3. Write a program to check whether a number is negative, positive, or zero.
  4. Write a program to check whether a number is divisible by 5 and 11.
  5. Write a program to check whether a number is even or odd.
  6. Write a program to check whether a year is a leap year or not.
  7. Write a program to check whether a character is an alphabet.
  8. Write a program to input any alphabet and check whether it is a vowel or consonant.
  9. Write a program to input any character and check whether it is the alphabet, digit, or special character.
  10. Write a program to check whether a character is an uppercase or lowercase alphabet.
  11. Write a program to input the week number and print the weekday.
  12. Write a program to input the month number and print the number of days in that month.
  13. Write a program to count the total number of notes in a given amount. Available Notes (500, 200, 100, 50, 20, 10, 5, 2, 1).
  14. Write a program to input the angles of a triangle and check whether a triangle is valid or not.
  15. Write a program to input all sides of a triangle and check whether a triangle is valid or not.
  16. Write a program to check whether the triangle is an equilateral, isosceles, or scalene triangle.
  17. Write a program to find all roots of a quadratic equation.
  18. Write a program to calculate profit or loss, where the buy value and the sell value are given.
  19. Write a program to input marks in five subjects Physics, Chemistry, Biology, Mathematics, and Computer. Calculate the percentage and grade according to the following: Percentage >= 90% : Grade A Percentage >= 80% : Grade B Percentage >= 70% : Grade C Percentage >= 60% : Grade D Percentage >= 40% : Grade E Percentage < 40% : Grade F
  20. Write a program to input the basic salary of an employee and calculate its Gross salary according to the following: Basic Salary <= 10000 : HRA = 20%, DA = 80% Basic Salary <= 20000 : HRA = 25%, DA = 90% Basic Salary > 20000 : HRA = 30%, DA = 95%
  21. Write a program to input electricity unit charges and calculate the total electricity bill according to the given condition: For the first 50 units Rs. 0.50/unit For the next 100 units Rs. 0.75/unit For the next 100 units Rs. 1.20/unit For units above 250 Rs. 1.50/unit An additional surcharge of 20% is added to the bill