C++ Flow-of-Control Programs (If-else, switch)

Back To C++ Index


1. program to demonstrate if statement example 1 , check whether number is equal to 10 or not - Code
2. program to demonstrate if statement example 2, check whether a number is greater than 10 or not - Code
3. program to demonstrate if statement example 3, check whether number is less than 10 or not - Code
4. program to demonstrate if statement example 4 , check whether number is less than or equal to 10 - Code
5. program to demonstrate if statement example 5 , check whether number is greater than or equal to 10 - Code
6. program to demonstrate if statement example 6 , check whether number is not equal to 10 - Code
7. program to demonstrate if-else statement example 1 , check whether number is equal to 10 or not - Code
8. program to demonstrate if-else statement example 2 , check whether number is greater than 10 or not - Code
9. program to demonstrate if-else statement example 3 , check whether number is less than 10 or not - Code
10. program to demonstrate if-else statement example 4, check whether number is equal to 10 or not - Code
11. program to demonstrate if-else statement example 5, check whether number is greater than 10 or not - Code
12. program to demonstrate if-else statement example 6, check whether a is less than or equal to 10 or greater than 10 - Code
13. program to demonstrate if-else statement example 7, check whether a is greater than or equal to 10 or less than 10 - Code
14. program to demonstrate if-else statement example 8, check whether a is greater than or equal to 10 or less than 10 - Code
15. program to demonstrate if-else statement example 9, check whether a is less than or equal to 10 or greater than 10 - Code
16. program to input three numbers and find largest of three numbers using if-else statement - Code
17. program to input three numbers and find smallest of three numbers using if-else statement - Code
18. program to demonstrate if-else statement and (check whether marks are between 80 and 90) - Code
19. program to demonstrate if-else statement program to demonstrate if or (check whether marks are equal to either 80 or 90) - Code
20. program to input a character and check whether it is equal to a or b using if statement example of OR( || ) operator - Code
21. program to change case of character example converting a to A example of if-else statement - Code
22. program to compute grade of a student based on marks using if else statement - Code
23. program to check whether number entered is odd or even using if-else statement - Code
24. program to input two numbers a and b and check whether a is divisible by b or not using if-else statement - Code
25. program to check whether user has entered vowel or not using if-else statement - Code
26. program to calculate discount on a price,if price is above 1000 then discount is 10% otherwise 5 % using if-else statement - Code
27. program to demonstrate switch-case statement example 1, displaying day of the week - Code
28. program to demonstrate switch-case example 2,displaying month of the year - Code
29. calculate da,hra based on basic example of if-else statement
(if basic<=2500,hra=da=0,if basic>=2500&&<4000,hra=20%,da=15% if basic>=4000&&<8000,hra=25,da=20,if basic>8000,hra=30,da=25) -
Code
30. program to input three numbers and print them in ascending order using if-else statement - Code
31. program to input three numbers and print them in descending order using if-else statement - Code
32. program to convert fahrenheit temp to celsius and vice versa using if-else statement - Code
33. program to convert fahrenheit temp to celsius and vice versa using switch statement - Code
34. program to input a character and check whether it is a vowel or not using switch statement - Code
35. program to input a year and find whether it is a leap year or not using if-else statement - Code