Exercise Questions - If

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

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

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

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

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

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

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

  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: C Python

  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: C

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

    Solution: C

  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: C

  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: C

  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: C

  27. WAP to generate electricity bill for n customers, keeping in mind different rates.
  28. Units Rates
    1 - 50 1.45
    51 - 100 2.6
    101 - 200 3.6
    Above 200 6.9

    Solution: C

  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: C

Advertisement


Advertisement