基础编程练习 7-10 计算工资 (15 分)

很简单的一道题,使我明白了,原来整型的数不可以直接在printf()中赋值给%f,如果那样写的话答案会变成0
真的是很涨知识,也许与printf函数的参数有关吧。

```C

include<stdio.h>

int main()
{
int y=0,wt=0;
scanf("%d %d",&y,&wt);
if(y >= 5)
{
if(wt <= 40)
printf("%.2f",wt50.0);
else
{
wt = wt - 40;
printf("%.2f",40
50+wt1.550);
}
}
else
{
if(wt <= 40)
printf("%.2f",wt30.0);
else
{
wt = wt - 40;
printf("%.2f",40
30+wt1.530);
}

    }
return 0;

}

猜你喜欢

转载自www.cnblogs.com/yinanweike/p/10742082.html