0% found this document useful (0 votes)
40 views1 page

C Tutorial If Else Questions

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)
40 views1 page

C Tutorial If Else Questions

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

m

ar
Sh
C Tutorial: Basic If-Else Questions

m
1. Write a program that takes an integer as input and checks whether it is even or odd.

ha
2. Write a program to input a number and check whether it is positive, negative, or zero.

3. Write a program to input two integers and print the largest of the two.

ub
4. Write a program that takes a person's age as input and checks if they are eligible to vote (age >=

18).
Sh
5. Write a program to input a number and check if it is divisible by 5 and 11.

6. Write a program to input a year and check if it is a leap year.

7. Write a program that takes a character as input and checks whether it is a vowel or consonant

(assume lowercase letters).

8. Write a program to check if a number is odd or even without using the modulus operator (%).

9. Write a program to input three angles of a triangle and check if it is valid (sum of angles = 180).

10. Write a program to input marks of a student and assign grades based on the following:

- Marks >= 90: Grade A

- Marks >= 75: Grade B

- Marks >= 50: Grade C

- Marks < 50: Fail

You might also like