-1

I am new to the C Programming table but i was wondering some can help me. I am trying to build a user input program with three line but whenever I put in the information i only get zeros. This is what I have have, can someone take a look and help me see my error please.

#include <stdio.h>

int main (void)

{
    int plus;
    float price;
    float mealTax = (4.5/100), total = 0;
    float division;

    printf("Enter hamberger price:$ ");
    scanf("%.2f", &price);
    fflush(stdin);                     /* clear input buffer */


    mealTax = price * mealTax;
    printf("\nMeal Tax price is $%.2f * $%.2f is $%.2f\n\n", mealTax, price, division);

    total = price + mealTax;
    printf("\nTotal price is $%.2f + $%.2f = $%.2f\n\n", price, mealTax);

    return 0;
    }
4

1 回答 1

0

对于 scanf 不.使用仅%f使用第二个问题是第二个printf没有给出足够的参数来打印我不确定你想打印的最后一个是什么但你确实需要一个

于 2013-07-01T02:04:58.093 回答