计算工资
本帖最后由 康小泡 于 2016-7-15 10:02 编辑源代码:;//计算工资
#include <stdio.h>
int main()
{
int day;
printf("本月工作几天?");
scanf("%d", &day);
int price;
int p;
int i;
int sum;
int sum1;
for (i = 0; i < day; ++i)
{
printf("\n请输入单线每天数目:");
scanf("%d", &price);
sum += price;
}
for (i = 0; i < day; ++i)
{
printf("\n请输入双线每天数目:");
scanf("%d",&p);
sum1 += price;
}
printf("\n单线一共穿了%d个\n",sum);
printf("\n双线一共穿了%d个\n", sum1);
printf("单线赚了%.2f元\n",sum * 0.023);
printf("双线赚了%.2f元\n", sum1 * 0.022);
printf("本月一共赚了%.2f元\n", (sum * 0.023) + (sum1 * 0.022));
return 0;
} 这个是不是小练习 天下语言原理皆一样
页:
[1]