lind_t1.c
来自「谭浩强第二版的课后习题的答案的源程序」· C语言 代码 · 共 26 行
C
26 行
#include<stdio.h>
void main()
{
int a[100]={0};
int i,j,m,n,t;
printf("Please input n&m.\nn presents the number of the people,\nm presents the number of people who should stand out.\n");
scanf("%d%d",&n,&m);
for(i=0,j=0;j<m*n;i++)
{
t=i;
if(a[i]==0)
j++;
if(i==n-1)
{
i=-1;
}
if(j%m==0&&a[t]==0)
{
printf("%d ",t+1);
a[t]=1;
}
}
printf("\n\n");
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?