Array and Strings – Geometry – Problem #3
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
In this question we will calculate the tax of an employee as per the income tax rules. Depending on the income, the amount of tax varies according to different income groups (or the tax slabs). The income tax department has provided a set of rules to calculate the tax of a person on taxable income according to the tax slab rules as shown in the table below. However, certain types of investments are considered as tax-free for minimum yearly income of Rs. 10, 00, 000, and the yearly taxable income will be computed after deducting those investments from the total income (upto certain limit). These investments are listed as follows: • House loan (upto Rs. 2, 50, 000) • Life insurance premium (upto Rs. 1, 50, 000) • Medical insurance (upto Rs. 50, 000) Yearly income tax slab Tax Rates Rs. 0 − 2, 50, 000 Nil Rs. 2, 50, 001 − 5, 00, 000 5% Rs. 5, 00, 001 − 7, 50, 000 Rs. 12500 + 10% of total income exceeding Rs. 5, 00, 000 Rs. 7, 50, 001 − 10, 00, 000 Rs. 37500 + 15% of total income exceeding Rs. 7, 50, 000 Rs. 10, 00, 001 − 12, 50, 000 Rs. 75000 + 20% of total income exceeding Rs. 10, 00, 000 Rs. 12, 50, 001 − 15, 00, 000 Rs. 125000 + 25% of total income exceeding Rs. 12, 50, 000 Above Rs. 15, 00, 000 Rs. 187500 + 30% of total income exceeding Rs. 15, 00, 000 Your task is to write a program that takes input from the user the monthly salary of a person, yearly house loan paid (if there is any), yearly life insurance premium paid (if there is any), yearly medical insurance paid (if there is any), and calculate the income tax based on the above rules. Example: Input: Monthly salary = 85000, house loan = 0, life insurance premium = 130000, medical insurance = 40000 Output: Total tax: 165000 Example: Input: Monthly salary = 130000, house loan = 275000, life insurance premium = 95000, medical insurance = 0 Output: Total tax: 318000