0% found this document useful (0 votes)
1 views

C if Else Questions Class9 Level

The document contains a list of C programming practice exercises focusing on conditional statements such as if, if-else, and else-if. Each exercise requires the implementation of a specific functionality, such as checking even or odd numbers, determining grades, and calculating electricity bills. The exercises are designed to enhance programming skills through practical applications of conditional logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

C if Else Questions Class9 Level

The document contains a list of C programming practice exercises focusing on conditional statements such as if, if-else, and else-if. Each exercise requires the implementation of a specific functionality, such as checking even or odd numbers, determining grades, and calculating electricity bills. The exercises are designed to enhance programming skills through practical applications of conditional logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

C Programming Practice: if, if-else, and else-if Questions

1. Check Even or Odd

Write a program to check if a number is even.

Use `if` to check if the number is divisible by 2.

2. Check if Number is Positive

Write a program to check if a number is greater than 0 (positive).

3. Greater or Smaller

Take two numbers as input and print which one is greater.

4. Pass or Fail

If a student scores more than or equal to 33 marks, print "Pass", else print "Fail".

5. Check Divisibility

Take a number and check if it is divisible by 5.

If yes, print 'Divisible by 5', else print 'Not Divisible by 5'.

6. Grade Calculator

Input marks (0 to 100) and print grade:

90-100: Grade A

70-89 : Grade B

50-69 : Grade C

33-49 : Grade D

0-32 : Fail

7. Largest of Three Numbers

Input three numbers and print the largest one.

8. Check for Leap Year

Input a year and check if it is a leap year.


Use the condition:

if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))

9. Check if Number is Multiple of 3

Input a number and check if it is a multiple of 3.

10. Voting Eligibility

Input age and check if the person is eligible to vote (age >= 18).

11. Check if Number is Zero, Positive or Negative

Input a number and check its sign.

12. Check Triangle Type

Input 3 angles. If they form a triangle:

- If all angles are equal, it's an equilateral triangle.

- If two are equal, it's isosceles.

- Otherwise, it's scalene.

13. Day of the Week

Input a number (1-7). Print the day of the week using if-else.

14. Check if Number is Between Two Values

Input a number and check if it lies between 10 and 50.

15. Find the Smallest of Two Numbers

Input two numbers and print the smaller one.

16. Electricity Bill Calculator

Input units:

- 0-100 units: Rs. 2/unit

- 101-200 units: Rs. 3/unit

- Above 200 units: Rs. 5/unit

17. Check Divisibility by 3 and 7


Input a number and check if it's divisible by 3 and 7.

18. Check if Character is a Vowel

Input a character and check if it's a vowel (a, e, i, o, u).

19. Check if Year is Century Year

Input a year. If divisible by 100, it's a century year.

20. Simple Calculator

Input two numbers and an operator (+, -, *, /). Perform the operation using if-else.

You might also like