D.7我的加班费

xiaoxiao2021-02-28  117

任务及代码

/* *copyright(c)2017,学院 *All rights reserved. *文件名称: main.c *作 者: 杨隆胜 *完成日期: 2017年8月6日 *版 本 号: v1.0 * *问题描述:小贺刚上班,按工作时间小时制领取周工资,工资标准是,每小时rate元RMB。每周工作时间40小时,如果要加班,超出部分按正常工资的 1.5倍计(老板还算不错喔!)。这周小贺上班的时间为hour小时,请编程序,输入rate和hour,输出小贺本周的薪水。 *输入描述:输入每小时rate元RMB,周小贺上班的时间为hour; *程序输出:小贺本周的薪水; */ #include <stdio.h> int main() { double dRate,dHour,dSalary; printf("Please input the Working time of XiaoHe this week:\n"); scanf("%lf",&dHour); printf("please input the salary of per hour:\n"); scanf("%lf",&dRate); if(dHour>40) { dSalary=40*dRate+1.5*dRate*(dHour-40); } else { dSalary=dHour*dRate; } printf("The salary of this week that should be payed for XiaoHe is:%.2lf\n",dSalary); return 0; }运行结果

转载请注明原文地址: https://www.6miu.com/read-44693.html

最新回复(0)