salary=basic+basic*daper/100+bonper* basic/100-loandet
数据为:name basic daper bonper loandet
MARK 2500 55 33.33 250.00
计算工资并将结果输出在下列标题下
Name Basic Salary
----------------解决方案--------------------------------------------------------
#include<stdio.h> void main() {
int basic,daper,loandet; float bonper,salary; char name[20]; basic=2500; daper=55; loandet=250; bonper=33.33f;
printf("输入名字:\n"); printf("输入基本工资:\n");
scanf("%s",&name); scanf("%d",&basic); salary=basic+basic+daper/100+bonper*basic/100-loandet;
printf("工资=%f\n",salary);
} 大家看看这样可以吗?
----------------解决方案--------------------------------------------------------
#include<stdio.h> void main() {
float basic,daper,loandet; float bonper,salary; char name[20]; /* basic=2500 */ daper=55; loandet=250; bonper=33.33f;
printf("输入名字:\n"); printf("输入基本工资:\n");
scanf("%s",&name); scanf("%f",&basic); salary=basic+basic*daper/100+bonper*basic/100-loandet;
printf("工资=%f\n", salary); getch();
} 试试这样
----------------解决方案--------------------------------------------------------
楼上的能说说为什么吗?
我很菜的说的简单点啊
呵呵
----------------解决方案--------------------------------------------------------
你把数据类型全部定义为float嘛,统一一下//
----------------解决方案--------------------------------------------------------
谢谢~
----------------解决方案--------------------------------------------------------