10: Write a program that takes salary amount from the user and applies tax to it. If salary is greater than 100000 deduct 10% tax otherwise deduct 5%. Print the net salary, and amount of tax deducted.

  


// Write a program that takes salary amount from the user and applies tax to it.
// If salary is greater than 100000 deduct 10% tax otherwise deduct 5%.
// Print the net salary, and amount of tax deducted.


#include <iostream>
using namespace std;

int main(){

        float gross_salary, five_tax, ten_tax, net_sal_five, net_sal_ten;

        cout << "Enter your monthly gross salary: Rs.";
        cin >> gross_salary;

            if(gross_salary >= 100000){
                ten_tax = gross_salary * 0.1;
                net_sal_ten = gross_salary - ten_tax;
                cout << "Your net salary is: Rs." << net_sal_ten << endl <<
                    "Tax deducted: Rs." << ten_tax << endl;
            }
            else{
                five_tax = gross_salary * 0.05;
                net_sal_five = gross_salary - five_tax;
                cout << "Your net salary is: Rs." << net_sal_five << endl <<
                    "Tax deducted: Rs." << five_tax << endl;
            }

    return 0;
}

Input 1:


Enter your monthly gross salary: Rs.54000

Output 1:


Your net salary is: Rs.51300 Tax deducted: Rs.2700

Input 2:


Enter your monthly gross salary: Rs.123000

Output 2:


Your net salary is: Rs.110700 Tax deducted: Rs.12300


Comments

Popular posts from this blog

88: Using switch statement Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to 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

205: Book Catalog: Define a struct to represent a book with attributes like title, author, and publication year. Write a program to create a catalog of books by taking user input and display books published after a certain year.

15: Take input of age and name of 3 people by user and determine oldest and youngest among them with his age. -_-_-_-_-_-_-_-_-(line with spaces input concept)-_-_-_-_-_-_-_-_