Create a c++ program to request the user to enter their monthly income and then display the tax payable.

+2 votes
asked Oct 18, 2019 by anonymous
by following the rules listed below:

1. If their income is less than R5000.00, they do not have to pay any tax.

2. If their income is less than R10000.00, they have to pay tax at the rate of 10% for the amount above R5000.00.

3. If their income is above R10000.00, they have to pay tax at the rate of 15% for the amount above R10000.00 plus R5000.00.

3 Answers

0 votes
answered Oct 19, 2019 by sawta
#include<stdio.h>
main()
{
    float income,tax,b=0.10,c=0.15;
    printf("enter your income= ");
    scanf("%f",&income);
    if(income<5000)
    {
        printf("No tax payable");
    }
    else if(income>=5000 && income<10000)
    {
        tax=(income*b);
        printf("tax payable=%f",tax);
    }
    else
    {
        tax=(income*c);
        printf("tax payble=%f",tax);
    }
}
0 votes
answered Oct 19, 2019 by Rajat
#include<stdio.h>

int main()

{

int sale,taxable;

float tax;

printf("Please enter your Monthly Income \n");

scanf("%d ",&sale);

if(sale<=5000)

{

taxable=0;

tax=0;

}

else

if(sale>5000&&sale<=10000)

{

taxable=sale-5000;

tax=0.1*taxable;

}

else

{

taxable=sale-5000;

tax=(0.15*(sale-10000))+5000;

}

printf("Your tax has been calculated and it is as displayed :\n");

printf("Monthly salary        :%d \n",sale);

printf("Taxable income       :%d \n",taxable);

printf("Tax payable            : %.2f \n",tax);

printf("Thank you to use our system \n");

}
0 votes
answered Oct 21, 2019 by gameforcer (2,950 points)

#include <iostream>

using namespace std;

int main()
{
    float income, tax;
    
    cout<<"Input your income:"<<endl;
    cin>>income;
    
    if(income < 5000)
        tax = 0;
    else if(income < 10000)
        tax = income * 0.1;
    else
        tax = income * 0.15 + 5000;
    
    cout<<"Tax to be paid is "<<tax;
    
    return 0;
}

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...