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

C++ Lab4

for If statements advance
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

C++ Lab4

for If statements advance
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Lecture 4: Control Structures (if, else, switch)

1. Write a program that checks if a number is even or odd using if condition.

2. Create a program to find the largest of three numbers using nested if.

3. Write a program that checks whether a number is positive, negative, or zero.

4. Create a program that assigns a grade based on marks entered by the user.

5. Write a program to check if a year is a leap year.

6. Create a program that uses a switch statement to display a day of the week.

7. Write a program that prints whether a character is a vowel or consonant using if and switch.

8. Create a program that reads an integer and displays whether it's a prime number.

9. Write a program that determines the eligibility for voting based on age.

10. Create a program that reads a number and checks if it's divisible by 5 and 11.

11. Write a program to print "Pass" if marks are greater than 50 using if condition.

12. Create a program that calculates a discount on a product price based on conditions.

13. Write a program to check whether a number is divisible by 2 or 3.

14. Create a program that prints "Valid" if the input is between 1 and 100, otherwise "Invalid".

15. Write a program to find whether a character is a digit or alphabet.

16. Create a program that reads an integer and checks if it's a perfect square.

17. Write a program to print the day of the week using a switch statement.

18. Create a program that uses a switch statement to calculate an arithmetic operation.

19. Write a program that asks for a month number and displays the number of days.

20. Create a program to check if a number is a multiple of 4 and 6.

You might also like