# Exercise Questions - If

1. WAP to Input number and find it is odd or even.
2. Solution:

3. WAP to Input year and find it is leap year or not.
4. Solution:

5. WAP to Input 2 numbers and find greater.
6. Solution:

7. WAP to Input 2 numbers and find smaller.
8. Solution:

9. WAP to check whether the input number is Positive or Negative.
10. Solution:

11. WAP to Input user age and find it is eligible for vote or not.
12. Solution:

13. WAP to Input 3 numbers and find the largest number.
14. Solution:

15. WAP to Input shopping amount and calculate discount, if amount is greater than or equals to 1000 than 15% discount is given otherwise 5%.
16. Solution:

17. WAP to Input 3 angles of triangle and check whether a triangle is valid or not. A triangle is valid if the sum of all the three angles equal to 180 degrees and no angle is equals to 0.
18. Solution:

19. WAP to Input 5 subjects marks of a student and find percentage & grade on the following slabs:
81 - 100 A
71 - 80 B
61 - 70 C
40 - 60 D
0 - 39 F

Solution:

21. WAP to input working hours of an employee and find wages on the following conditions:
22. Hours Wages
First 8 hrs Rs 600 per hour
Next 4 hrs Rs 400 per hour
Next 4 hrs Rs 300 per hour
Next 4 hrs Rs 200 per hour

Solution:

23. WAP to input annual salary and calculate tax based on the following slab:
24. Annual Salary Tax
Below 50000 Nil
50001 – 90000 20%
90001 – 150000 30%
Above 150001 35%

Solution:

25. WAP to Input the value of basic salary and calculate the HRA, DA, PF and total salary. (Total salary=basic salary + HRA + DA – PF).
26. Basic salary HRA DA PF
>25000 10.25% 8.5% 5.5%
>15000 to <=25000 8.25% 5.5% 3.5%
>7500 to <=15000 5.5% 3.5% 1.5%
>=2500 to <=7500 3.5% 2.5% 1.05%
<2500 2.5% 1.0% 0.5%

Solution:

27. WAP to generate electricity bill for a customer, keeping in mind different rates.
28. Units Rate per unit
0 - 200 Rs 3.00
201 - 400 Rs 4.50
401 - 800 Rs 6.50
801 - 1200 Rs 7.00
Above 1200 Rs 8.00
Free upto 200 units

Solution:

29. A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard, WAP to find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.
30. Solution: