向用户询问每个轮胎的数量和价格,然后计算总价格,增加销售税。

#include <stdio.h>
#define SALESTAX .07

int main(){

    int numTires;
    float tirePrice, beforeTax, netSales;

    printf("How many tires did you purchase? ");
    scanf(" %d", &numTires);

    printf("What was the cost per tire (enter in $XX.XX format)? ");
    scanf(" $%f", &tirePrice);

    beforeTax = tirePrice * numTires;
    netSales = beforeTax + (beforeTax * SALESTAX);
    printf("%You spent $%.2f on your tires/n/n/n", netSales);

    return 0;
}

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266779.html

(0)
上一篇 2022年6月7日
下一篇 2022年6月7日

相关推荐

发表回复

登录后才能评论