Set - 01 (if/else) related problems

   100 Problems   

Set - 01 (if/else) related problems, competitive programming

1. Write a program that takes two numbers as input and prints the larger number.
2. Write a program that takes an integer as input and checks if it is positive or negative.
3. Write a program that takes three numbers as input and prints the smallest number.
4. Write a program that takes a character as input and checks if it is a vowel or consonant.
5. Write a program that inputs an integer and checks if it is even or odd.
6. Write a program that takes three numbers as input and prints the largest number.
7. Write a program that takes a grade as input and prints "Pass" if the grade is above or equal to 60, and prints "Fail" otherwise.
8. Write a program that takes three numbers as input and prints them in ascending order.
9. Write a program that takes a character as input and checks if it is a letter, digit, or special character.
10. Write a program that takes an integer as input and checks if it is a prime number.
11. Write a program that takes the radius of a circle as input and calculates its area. Print the result.
12. Write a program that takes two integers as input and checks if they are equal.
13. Write a program that takes an integer as input and checks if it is positive, negative, or zero.
14. Write a program that takes a year as input and checks if it is a leap year.
15. Write a program that takes three numbers as input and checks if they form a triangle.
16. Write a program that takes an age as input and checks if the person is eligible to vote (age 18 or above).
17. Write a program that takes three numbers as input and checks if they are in descending order.
18. Write a program that takes two characters as input and checks if they are equal (case-insensitive).
19. Write a program that takes an integer as input and checks if it is a perfect square.
20. Write a program that takes two numbers as input and prints the larger number, but if the numbers are equal, print "Equal".
21. Write a program that takes an integer as input and checks if it is divisible by 3 and 5 (both conditions should be satisfied).
22. Write a program that takes a month as input (e.g., 1 for January) and prints the number of days in that month.
23. Write a program that takes a three-digit number as input and checks if it is a palindrome.
24. Write a program that takes a character as input and checks if it is an uppercase letter.
25. Write a program that takes a number as input and prints its absolute value.
26. Write a program that takes a character as input and checks if it is a whitespace character (e.g., space, tab, newline).
27. Write a program that takes two characters as input and checks if they are both vowels.
28. Write a program that takes an integer as input and checks if it is a multiple of 4.
29. Write a program that takes a sentence as input and checks if it starts with a capital letter.
30. Write a program that takes a year as input and checks if it is a leap year, considering both the Gregorian and Julian calendars.
31. Write a program that takes three numbers as input and checks if they are all different.
32. Write a program that takes two integers as input and prints the result of their division. Handle the case where the second number is zero separately and print "Cannot divide by zero!".
33. Write a program that takes a character as input and checks if it is a lowercase vowel.
34. Write a program that takes a sentence as input and counts the number of uppercase letters.
35. Write a program that takes a positive integer as input and checks if it is a power of 2.
36. Write a program that takes two integers as input and checks if their sum is odd.
37. Write a program that takes three numbers as input and checks if they are all positive.
38. Write a program that takes two integers as input and checks if one is positive and the other is negative.
39. Write a program that takes two integers as input and checks if their sum is greater than 100.
40. Write a program that takes a character as input and checks if it is a special character (not a letter or digit).
41. Write a program that takes a number as input and checks if it is a multiple of both 3 and 5 (either condition should be satisfied).
42. Write a program that takes a three-digit number as input and checks if the sum of its digits is even.
43. Write a program that takes two integers as input and checks if their product is negative.
44. Write a program that takes a character as input and checks if it is an alphanumeric character.
45. Write a program that takes a two-digit number as input and checks if the sum of its digits is divisible by 3.
46. Write a program that takes two integers as input and checks if their sum is divisible by 7.
47. Write a program that takes a sentence as input and checks if it ends with a period.
48. Write a program that takes a number as input and checks if it is a multiple of both 2 and 3.
49. Write a program that takes two integers as input and checks if their difference is divisible by 2.
50. Write a program that takes a character as input and checks if it is a lowercase consonant.
51. Write a program that takes an integer as input and checks if it is a multiple of both 4 and 5.
52. Write a program that takes two integers as input and checks if their product is positive.
53. Write a program that takes a character as input and checks if it is a digit.
54. Write a program that takes an integer as input and checks if it is a perfect cube.
55. Write a program that takes two integers as input and checks if their difference is positive.
56. Write a program that takes a sentence as input and checks if it contains the word "hello".
57. Write a program that takes a number as input and checks if it is a multiple of either 3 or 7.
58. Write a program that takes three numbers as input and checks if their sum is equal to 100.
59. Write a program that takes a character as input and checks if it is an ASCII character.
60. Write a program that takes a positive integer as input and checks if it is a palindrome.
61. Write a program that takes two integers as input and checks if their sum is divisible by 6.
62. Write a program that takes a sentence as input and checks if all the words start with a capital letter.
63. Write a program that takes a number as input and checks if it is a multiple of both 2 and 4.
64. Write a program that takes two integers as input and checks if their product is even.
65. Write a program that takes a character as input and checks if it is a printable character.
66. Write a program that takes a positive integer as input and checks if it is a prime number.
67. Write a program that takes two integers as input and checks if their difference is divisible by 3.
68. Write a program that takes a sentence as input and checks if it contains the word "world".
69. Write a program that takes a number as input and checks if it is a multiple of both 5 and 6.
70. Write a program that takes two integers as input and checks if their product is negative or zero.
71. Write a program that takes a character as input and checks if it is an alphabetic character.
72. Write a program that takes a string as input and checks if it is a palindrome.
73. Write a program that takes two integers as input and checks if their difference is even.
74. Write a program that takes a sentence as input and checks if all the words end with a period.
75. Write a program that takes a year as input and checks if it is a leap year, considering both the Gregorian and Julian calendars.
76. Write a program that takes a number as input and checks if it is a multiple of both 3 and 4.
77. Write a program that takes two integers as input and checks if their product is positive or zero.
78. Write a program that takes a character as input and checks if it is a whitespace or a special character.
79. Write a program that takes a sentence as input and checks if it contains the word "goodbye".
80. Write a program that takes a number as input and checks if it is a multiple of either 4 or 7.
81. Write a program that takes two integers as input and checks if their difference is negative.
82. Write a program that takes a sentence as input and checks if it contains all the vowels (a, e, i, o, u).
83. Write a program that takes a number as input and checks if it is a multiple of either 5 or 6.
84. Write a program that takes two integers as input and checks if their product is negative or zero.
85. Write a program that takes a character as input and checks if it is a printable or a whitespace character.
86. Write a program that takes a sentence as input and checks if it contains any palindromic words (e.g., level, radar).
87. Write a program that takes a number as input and checks if it is a multiple of both 2 and 5.
88. Write a program that takes two integers as input and checks if their product is odd.
89. Write a program that takes a character as input and checks if it is a letter or a digit.
90. Write a program that takes a sentence as input and checks if it contains both the word "hello" and "world".
91. Write a program that takes a number as input and checks if it is a multiple of either 2 or 6.
92. Write a program that takes two integers as input and checks if their product is positive or negative.
93. Write a program that takes a character as input and checks if it is a lowercase letter.
94. Write a program that takes a sentence as input and checks if all the words contain only lowercase letters.
95. Write a program that takes a number as input and checks if it is a multiple of both 4 and 6.
96. Write a program that takes two integers as input and checks if their product is odd or zero.
97. Write a program that takes a character as input and checks if it is an uppercase or a lowercase letter.
98. Write a program that takes a sentence as input and checks if it contains any repeated words.
99. Write a program that takes a number as input and checks if it is a multiple of either 2 or 7.
100. Write a program that takes two integers as input and checks if their product is negative or zero, but if both numbers are zero, print "Both numbers are zero!".

Comments

Contact Form

Send

Archive