#include <stdio.h>
#include <stdlib.h>
//输入三个数,输出最大值,考察知识点:数据调整顺序
int main()
{
int a,b,c;
int max;
printf("please input three numbers:");
scanf("%d %d %d",&a,&b,&c);
max=a;
if(b>=max)
{
max=b;
}
if(c>=max)
{
max=c;
}
printf("最大值为%d",max);
return 0;
}
<pre name="code" class="cpp">#include <stdio.h>
#include <stdlib.h>
//求工资,40小时内20元,40小时以上30元
int main()
{
int hours;
int bonus;
printf("请输入一周工时:");
scanf("%d",&hours);
if(hours<=40)
{
bonus=hours*20;
}
else
{
bonus=40*20+(hours-40)*30;
}
printf("工资为%d",bonus);
return 0;
}