Im trying to write a program for school, and its supposed to :
Using loop , write a program to read as many data as the user wishes to enter. The program will read the number of dependants and of income for each entry. Test every entry and print their tax rate based on the following:
If the number of dependants is >= 5 and the income <= $25000 tax rate = 10%
If the number is between 2 and <= 5 and the income is <=$45000 tax rate=20%
If the number is <= 1 and the income is >= $45000 the taxe rate =30%
Everything else is 40% tax rate.
(supposed to use While statement)
This is where i got but im afraid im kinda stuck (Im a noob ^^)
Code:
main()
{
int dependant;
long income;
printf ("Thank you for using my Tax calculator");
printf ("Please enter your annual income: )"
scanf ("%ld", &income);
printf ("Please enter the number of dependants in your house hold")
scanf ("%d", &dependant);
while (true)
{
if(dependant >= 5 && income <= 25000)
{printf ("Your tax rate is : 10%");}
else if(dependant >= 2 && dpendant <= 5 && income <= 45000)
{printf ("Your tax rate is : 20%);}
else if(dependant <= 1 && income >= 45000)
{printf ("Your tax rate is : 30%");}
else
{printf ("Your tax rate is : 40%");}
}
getch();
}