游客通过提示输入预付的钱数 ,游玩的时间 和每小时的单价就会输出找零或者需要补交的钱数
#include <stdio.h>
int main (void)
{
int money;//预付定钱数
int h;//游玩的时间
int price;//单价
printf("please input how much\n ");
scanf("%d",&money);
printf("please input time\n");
scanf("%d",&h);
printf("please input price\n");
scanf("%d",&price);
if (h != (int)h)
{
h = (int)h + 1;
}
else if (( money-h*price)> 0)
{
printf("return you %d¥\n", money-h*price );
}
if ((money-h*price)<0)
{
printf("you should give this much money %d¥\n",-( money-h*price));
}
}