Lowest price ever! Learn Generative AI for 48% less!
Get my discount- 1
Help me debug this one...
#include <stdio.h> #include <stdlib.h> int main() { int gross; int net; int taxam; printf("PLEASE INPUT THE GROSS PAY"); scanf("%d" ,& gross); if (gross<20000) { printf("NET PAY = ",gross); printf("TAX AMOUNT =0"); } else if(20000<=gross<30000) { printf("YOUR NET PAY IS:",gross*0.90); printf("YOUR GROSS TAX IS:" gross* 0.10); } else if(30000<=gross<40000) { printf("YOUR NET PAY IS: " ,gross*0.85); printf("YOUR TAX AMOUNT IS:",gross*0.15); } else if(40000<=gross<50000) { printf("YOUR NET PAY IS: " ,gross*0.80); printf("YOUR TAX AMOUNT IS:",gross*0.20); } else { printf("YOUR NET PAY IS: " ,gross*0.70); printf("YOUR TAX AMOUNT IS:",gross*0.30); } return 0; }
10 Answers
+ 2
There are way to many places you made mistakes at...You didn't place any format specifiers in your printf's plus your if and else statements are badly written..
+ 2
You just need to learn more about C then you'll understand it better...good luck.
+ 2
Kodak
You have incorrectly created the conditions for calculating the tax.
+ 1
Here's the fixed version
https://code.sololearn.com/ckhDpd9it6Nc/?ref=app
+ 1
https://code.sololearn.com/cghrfSlBuA5A/?ref=app
+ 1
Vasiliy what do you mean???
+ 1
Kodak
else if(20000<=gross||gross<30000) // || stands for or, but you must "and" - "&&"☺
0
Kodak...please explain
0
Thanks kodak...that really helps