Top 30 programming questions on Conditional Statements in C
Q 1. Check if a number is even or odd.
Expected Output:
Enter an integer: 4
4 is even.
Q 2. Find the largest of two numbers.
Expected Output:
Enter two integers: 3 7
Largest number is 7.
Q 3. Check if a character is a vowel or consonant.
Expected Output:
Enter a character: i
i is a vowel.
Q 4. Check if a number is positive, negative, or zero.
Expected Output:
Enter an integer: -5
-5 is negative.
Q 5. Find the largest of three numbers.
Expected Output:
Enter three integers: 12 5 9
Largest number is 12.
Q 6. Check if a year is a leap year.
Expected Output:
Enter a year: 2020
2020 is a leap year.
Q 7. Check if a number is divisible by 5 and 11.
Expected Output:
Enter an integer: 55
55 is divisible by both 5 and 11.
Q 8. Check if a character is an alphabet.
Expected Output:
Enter a character: G
G is an alphabet.
Q 9. Check if a character is an uppercase or lowercase letter.
Expected Output:
Enter a character: h
h is a lowercase letter.
Q 10. Check if a number is divisible by 3 or 7.
Expected Output:
Enter an integer: 21
21 is divisible by 3 or 7.
Q 11. Check if a number is prime.
Expected Output:
Enter an integer: 7
7 is a prime number.
Q 12. Check if a number is a multiple of 3, 5, or both.
Expected Output:
Enter an integer: 15
15 is a multiple of both 3 and 5.
Q 13. Check if a character is a digit.
Expected Output:
Enter a character: 7
7 is a digit.
Q 14. Check if a number is a palindrome.
Expected Output:
Enter an integer: 121
121 is a palindrome.
Q 15. Check if a number is an Armstrong number.
Expected Output:
Enter an integer: 153
153 is an Armstrong number.
Q 16. Check if a year is a century year.
Expected Output:
Enter a year: 1900
1900 is a century year.
Q 17. Determine the grade based on marks.
Expected Output:
Enter marks: 85
Grade: B
Q 18. Check if the sum of two numbers is greater than 100.
Expected Output:
Enter two integers: 40 70
The sum is greater than 100.
Q 19. Check if a number is a multiple of both 4 and 6.
Expected Output:
Enter an integer: 24
24 is a multiple of both 4 and 6.
Q 20. Determine the eligibility to vote based on age.
Expected Output:
Enter your age: 20
You are eligible to vote.
Q 21. Check if a triangle is equilateral, isosceles, or scalene.
Expected Output:
Enter three sides of a triangle: 7 7 7
The triangle is equilateral.
Q 22. Check if a number is within a range.
Expected Output:
Enter a number: 15
Enter lower and upper limits: 10 20
15 is within the range [10, 20].
Q 23. Check if a number is positive and even.
Expected Output:
Enter an integer: 12
12 is positive and even.
Q 24. Check if a number is a multiple of 10.
Expected Output:
Enter an integer: 50
50 is a multiple of 10.
Q 25. Check if a number is within 100 of 1000.
Expected Output:
Enter an integer: 950
950 is within 100 of 1000.
Q 26. Check if a number is divisible by 2, 3, or both.
Expected Output:
Enter an integer: 12
12 is divisible by both 2 and 3.
Q 27. Check if three numbers can form a valid triangle.
Expected Output:
Enter three sides of a triangle: 3 4 5
The sides form a valid triangle.
Q 28. Check if a number is a prime number.
Expected Output:
Enter an integer: 29
29 is a prime number.
Q 29. Find the largest of three numbers.
Expected Output:
Enter three integers: 15 7 12
15 is the largest.
Q 30. Determine if a number is odd or even.
Expected Output:
Enter an integer: 10
10 is even.
Bikki Singh
Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!