# Calculating Taxes

• 10-22-2008
Mark_Guy
Calculating Taxes
I am neding some assistance with this samll problem that I am having. I am trying to simply

Some food items and all non-food items are subject to a statewide sales tax and local district taxes. Due to differences in district taxes, each store uses a different tax rate.
Del Mar - 7.25&#37;
Encinitas - 7.5%
La Jolla - 7.75%
Expected Results/Impact when completed:

C program that displays the sales tax amount for each store location for a purchase amount of \$125.00.

But after doing it all it will not show anything on the excute screen. Any advice?
Code:

```#include <stdio.h> int main(void) {     //Declare Variables     float fsubtotal, taxdelmar, taxencinitas, taxlajolla;     float fCost;//calculation operator     int iResponse = 0;         fCost = 0;     fsubtotal=125.00;     taxdelmar=.0725;     taxencinitas=.0750;     taxlajolla=.0775;         getchar();         return 0;```
• 10-22-2008
laserlight

At a glance, the reason why it will not show anything is because you did not print anything (not to mention that you did not compute anything, either).

Oh, and please post your well indented code in [code][/code] tags. By the way, why do you return 5 instead of 0 when main exits successfully?
• 10-22-2008
valaris
You would just have to think how you would mathematically calculate this without programming. Do that, and maybe store its result in a variable, then use printf() to print it out. Also why return 5? Should be return 0.
• 10-22-2008
Mark_Guy
tax calculator
Sorry it is only my second week in a programming class and i am tring to figure ths all out but you dont have to help but you can keep your negative comments to yourself
• 10-22-2008
laserlight
Quote:

i am tring to figure ths all out
Okay, so you understand that the main reason why you are getting no output is that you did not print any output?

Quote:

So far, no one has posted any negative comments.
• 10-22-2008
Mark_Guy
sales tax
yes i understand that is why I want it so that it will output the information. i added the printf as told and put in the other information and came up with same thing. sorry second week in a computer class ever just trying to get my feet wet.
• 10-22-2008
Mark_Guy
Code:

```#include <stdio.h> int main(void) {     //Declare Variables     float fsubtotal, taxdelmar, taxencinitas, taxlajolla;     float fCost;//calculation operator     int iResponse = 0;         fCost = 125.00;     fsubtotal = 125.00;     taxdelmar = .0725;     taxencinitas = .0750;     taxlajolla = .0775;           printf("\n\tKudler Fine Foods 'Sales Tax Calculator'\n");     printf("125*.0725\n");     getchar();     }```
• 10-22-2008
tabstop
So that just prints literally "125*.0725", it does not print the value of the calculation. I would guess you need to reread your notes (or maybe someone else's notes) on printf, especially the part where they talk about %.
• 10-22-2008
rags_to_riches
You can always just search this forum for University of Phoenix, La Jolla, whatever. We get questions on this U of P assignment every six months or so.