《C语言程序设计》江宝钏主编-习题4-4-加班费

AC代码:

/*《C语言程序设计》江宝钏主编-习题4-4-加班费
Description 
编写一个计算员工收入的程序,公司按照规定工时的工资10元/小时付给每个员工160个工时的薪水,按3倍的工资率付给160个工时以外的工资。
Input 
输入员工的工时数,1个整数。
Output 
计算员工的收入

Sample Input Copy 
20
Sample Output Copy 
200
*/

#include <stdio.h>
int main()
{
    int times,salary;
    scanf("%d",&times);
    if(times>160)
    {
        salary = 160*10+(times-160)*3*10;
        printf("%d",salary);
    }
    else
    {
        salary = 10*times;
        printf("%d",salary);
    }
    return 0;
}

//标程:
#include <stdio.h>
int main()
{
	int t,profit;
	scanf("%d",&t);
	if(t<=160)
	{
		profit=10*t;
	}
	if(t>160)
	{
		profit=1600+(t-160)*10*3;
	}
	printf("%d\n",profit);
	return 0;	
}
发布了39 篇原创文章 · 获赞 7 · 访问量 3685

猜你喜欢

转载自blog.csdn.net/qq_45599068/article/details/104089628