问题中国有句俗语叫“三天打鱼两天晒网”。假设某人从某天起,开始“三天打鱼两天晒网”,问这个人在以后的第N天中是“打鱼”还是“晒网”?
代码如下:
#include <stdio.h>
int main()
{
int a,c;
scanf("%d",&a);
c=a%5;
if(c>=1&&c<=3){
printf(“Fishing in day %d”,a);
}else{
printf(“Drying in day %d”,a);
}
return 0;
}
也可以使用switch语句实现,读者可自行编写。
三天打鱼两天晒网
最新推荐文章于 2022-11-30 07:27:24 发布