# include <iostream.h>
# include <conio.h>
int main()
{
float income=0;
int tax=0;
float r1=0.0;
float r2=0.1;
float r3=0.2;
float r4=0.3;
float r5=0.4;
float r6=0.5;
cout<<"Enter income:";
cin>>income;
if(income>=100,001)
tax=income*r6;
else if(income<=100,000 && income >=70,001)
tax=income*r5;
else if(income>=70,000 && income >=50,001)
tax=income*r4;
else if(income>=50,000 && income >=30,001)
tax=income*r3;
else if(income>=30,000 && income >=10,001)
tax=income*r2;
else if(income>=10,000 && income >0)
tax=income*r1;
cout<<"Income tax is :"<<tax;
getch() ;
}
sujanthi.kumari
0
Newbie Poster
Recommended Answers
Jump to PostYour biggest problem is including commas in the number. While visually appealing, it doesn't return the right value.
Your second biggest problem is your setting the limits of each if statement with 2 greaterthan or equals signs, instead of greater than or equal for the lower limit and less than …
Jump to PostI was hoping to coax the OP into solving the issue, or at the very least go over the specific problems it had with us explicitly, but oh well.
If it helps any (which I doubt, but who knows), here is how I would solve this problem:
All 7 Replies
WhiZTiM
-3
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
tinstaafl
1,176
Posting Maven
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
ddanbe
commented:
Nice code
+14
sujanthi.kumari
commented:
thanks
+0
mridul.ahuja
4
Coding Enthusiast
ddanbe
2,724
Professional Procrastinator
Featured Poster
new_developer
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.