解题思路:
emmmmm
注意事项:
emmmm
参考代码:
#include <stdio.h>
int main(void)
{
int year, cow;
int i;
printf("请输几年: ");
scanf("%d", &year);
for ( i = 1; i <= year; i ++ )
{
if ( i < 5 )
{
cow = 1 + i;
printf("第%6d年,共有%6d头奶牛\n", i, cow);
continue;
}
else
{
cow += i - 4 + 1;
printf("第%6d年,共有%6d头奶牛\n", i, cow);
}
}
return 0;
}
0.0分
0 人评分