报数问题函数好像有错了?
#include<stdio.h>#include<stdlib.h>
void main()
{
int n, s, m; //int num[n+1], out[n];
void count(int n, int s, int m);
count(n, s, m);
}
void count(int n, int s, int m)
{ //int x=n;
int i, j = 0, t = 0;
int num[10];
int out[9];
printf("input n:\n");
scanf("%d", &n);
printf("input s:\n");
scanf("%d", &s);
printf("input m:\n");
scanf("%d", &m);
if (m <= 0){printf("m<=0");exit(0);}
for (i = 0;i < n + 1;i++)
{num[i] = i;printf("num[%d]=%d\n",i,num[i]);}
for (i = s;t < n;i++)
{
if (i == n)i = 1;
while (num[i] != 0)
{
j++;
if (j == m)
{
out[t] = num[i];
t++;
num[i] = 0;
j = 0;
}
}
}
for(i=0;i<n;i++)
printf("%d",out[i]);
}