[求助]编写一个含有while的程序
在while循环体内,计算23%的联邦代扣税款和7%的州代扣税款,把它们与相应的工资一起显示出来,计算被显示的所有工资和税金的累加和。在程序退出while循环后显示这些累加和。谢谢!
#include<stdio.h>
int main()
{
double wage=0,sum_tax1=0,sum_tax2=0,sum_wage=0;
printf("input wages,end with number 0);
while(scanf("%lf",&wage)&&(wage!=0))
{
sum_wage+=wage;
sum_tax1+=wage*0.23;
sum_tax2+=wage*0.07;
printf("%10.2lf%10.2lf%10.2lf\n",wage,wage*0.23,wage*0.07);
}
printf("sum_wage=%10.2lf\n",sum_wage);
printf("sum_tax1=%10.2lf\n",sum_tax1);
printf("sum_tax2=%10.2lf\n",sum_tax2);
return 0;
}
是不是这个意思?
不是的话请写详细一点.