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();
} 试试这样