# If else programming exercises and solutions in C

Prof. Fazal Rehman Shamil
Let us see a list of important If else programming exercises and solutions in C++.

1. Program to calculate the bill in c++
2. CPP program to check that the entered character is small, capital, or a special character
3. Program in C++ to check that whether a number is even or odd with flowchart
4. 0 is a positive or negative number
5. Program to find the positive and negative number
6. Enter Range of numbers and replaced them in C++
7. Program to find greater number among three numbers in c++ and C with flowchart
8. Armstrong Number Program in C++, C Plus Plus CPP with Flowchart
9. ASCII code Program in C++ (C Plus Plus)
10. Find the Maximum value program in C++ (C Plus Plus).
11. C++  Program to find the maximum between three numbers by using the if-else statement. C++ Program for the maximum number
12. C++  Program to take a value from the user as input the basic salary of an employee and calculate its Gross salary according to the following: Basic Salary <= 10000: HRA = 20%, DA = 80%………………………………..Basic Salary <= 20000 : HRA = 25%, DA = 90%………………………………Basic Salary > 20000 : HRA = 30%, DA = 95%.
13. C++  Program to find the maximum between two numbers by using the if-else statement. Maximum Number Program
14.  Using the if-else C++  Program to take a value from the user as input electricity unit charges and calculate total electricity bill according to the given condition: For the first 50 units Rs. 0.50/unit………….For the next 100 units Rs. 0.75/unit…..For the next 100 units Rs. 1.20/unit ……………For unit above 250 Rs. 1.50/unit………An additional surcharge of 20% is added to the bill…….Using if-else.
15. Write a program that determines a student’s grade. The program will read three types of scores (quiz, mid-term, and final scores) and determine the grade based on the following rules:if the average score =90% =>grade=A…………………..-if the average score >= 70% and <90% => grade=B……………………-if the average score>=50% and <70% =>grade=C……………………..-if the average score<50% =>grade=F. Click Here
16. C++  Program to check whether a number is divisible by 5 and 11 or not by using if-else. The number is divisible by 11 or 5 or not
17. C++  Program to count the total number of notes in a given amount. Using if-else
18. C++  Program to take a value from the user as input the angles of a triangle and check whether the triangle is valid or not by using the if-else statement. Triangle program
19. C++  Program to take a value from the user as input all sides of a triangle and check whether the triangle is valid or not. Using if-else.
20. C++  Program to check whether the triangle is an equilateral, isosceles or scalene triangle. Using the if-else statement. – Click Here
21. C++  Program to find all the roots of a quadratic equation. Using if-else.
22. C++  Program to calculate profit or loss. Using if-else.
23. C++  Program to check whether a year is a leap year or not by using an if-else statement. Leap year program
24. C++  Program to check whether a character is an alphabet or not. Using if-else. Click Here
25. C++  Program to take a value from the user as input any alphabet and check whether it is vowel or consonant. Using if-else.
26. Using if-else C++  Program to take a value from the to take a value from the user as input  marks of five subjects Physics, Chemistry, Biology, Mathematics, and Computer. Calculate percentage and grade according to the following: Percentage >= 90% : Grade A, Percentage >= 80% : Grade B, Percentage >= 70% : Grade C, Percentage >= 60% : Grade D, Percentage >= 40% : Grade E, Percentage < 40% : Grade F, Write this program with the help of  if-else statement. Grade and Percentage Program
27. C++  Program to take a value from the user as input any character and check whether it is the alphabet, digit or special character. Using if-else. Click Here
28. C++  Program to check whether a character is an uppercase or lowercase alphabet. Using if-else. Click Here.
29. C++  Program to take value from the user as an input weekday number and print weekday by using if-else statement. Weekday program
30. C++  Program to take a value from the user as input the month number and print number of days in that month. Using if-else.\
31. C++ Program to check whether a number is a prime or composite number. Click Here
32. Program to take the hours and minutes as input by the user and the show that whether it is AM or PM using if-else statement – Click Here
33. Write a program to swap the values of two number if values of both variables are not the same using if-else statement – Click Here
34. Program to update even number into its upper nearest odd number. C++ Program to update even to odd
35. Write a C program to calculate profit or loss by using if-else. Profit Loss Program
36. Write a C++ Program to convert centimeter into meter and kilometer using the if-else statement. Program of centimeter into meter and kilometer
37. Write a C++ program to input all sides of a triangle and check whether the triangle is valid or not. Using the switch statement. Triangle Program
38. C PROGRAM TO INPUT THE BASIC SALARY OF AN EMPLOYEE AND CALCULATE ITS GROSS SALARY BY USING THE IF-ELSE STATEMENT –  Salary Program

39. Write a C++ program in which a user enters a number, and the program will find the Even and odd number. Your program should only accept integers of length 2 or higher and should ask the user to re-enter a value if the value containing total numbers of integers less than 2. The program with goto statement. Even odd program with goto statement.
40. C++ program to calculate area of the circle if the radius is greter than 0 using goto statement.

## Basic Tutorial of conditional statements  Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,