im a beginner and ive been stuck wit this new program ive written
everytime i try to do a calculation it give me 0.00 for answer plz help me! i cant find what i did wrong...ty
im a beginner and ive been stuck wit this new program ive written
everytime i try to do a calculation it give me 0.00 for answer plz help me! i cant find what i did wrong...ty
Change the %d to %f.Code:fprintf(wptr," Your incomes = %d ",&income); fprintf(wptr,"\n\n Your tax = %d ",&tax);
Looking at the quoted code, remove the & symbol. Unless you actually mean to be printing the address of those two variables...
Quzah.
Hope is the first step on the road to disappointment.
Also, if you're trying to write C, then name your files with a .c extension. Otherwise your compiler is likely to compile it as C++.
If you understand what you're doing, you're not learning anything.
thnx a lot that fixed some of my error. The first time i type in a number for income it work fine but the second income number i put in it will alway give me the answer for the first one..can some1 help me plz?
Last edited by Desperate; 07-06-2006 at 08:39 AM.
Should be %fCode:scanf("%d", &income);
Surrounding the zero in single quotes turns it into a character and I think you'll be getting the ASCII value rather than 0.Code:tax = '0';}
The semi-colon shouldn't be there and else can't take parenthesis, use else if again instead.Code:else(income > 13430 && income <= 15610);{