满足题目,你可以测试一下
#include <stdio.h>
int main()
{
int X[33],S[20],i,I;
for(i=0;i<33;i++)
X[i]=i+1;
int n,m,a=0,b=0,gate=0;
printf("how many numbers do you wang to appoint?
");
while(scanf("%d",&n))
{
if(n==1)
{
while(scanf("%d",&a))
{
if(a<=33&&a>=1)
{
gate=1;
break;
}
else
printf("input 1 to 33:
");
}
}
else if (n==2)
{
while(scanf("%d%d",&a,&b))
{
if(a<=33&&a>=1&&b<=33&&b>=1)
{
gate=1;
break;
}
else
printf("input 1 to 33:
");
}
}
else if (n==0)
break;
else
printf("you just can input 0,1 or 2:
");
if(gate==1)
break;
}
printf("how many numbers do you wang to select?
");
while(scanf("%d",&m))
{
if(m>=10&&m<=20)
break;
else
printf("you just can select between 10 and 20:
");
}
I=m/6;
for(i=0;i<I;i++)
{
if(n==0)
printf("the %dth case:\n%d
%d
%d
%d
%d
%d\n",i+1,i+1,i+2,i+12,i+13,i+23,i+24);
else if(n==1)
printf("the %dth case:\n%d
%d
%d
%d
%d
%d\n",i+1,a,i+2,i+12,i+13,i+23,i+24);
else
{
printf("the %dth case:\n%d
%d
%d
%d
%d
%d\n",i+1,a,i+2,b,i+13,i+23,i+24);
}
}
return 0;
}