刚刚学循环...
#include<stdio.h>#include<time.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int i,j,k,l,m; char reply1='y',reply2;
srand((unsigned)time(NULL));
for(;reply1=='y';)
{
printf("Magical things will happen to you!\n\n");
j=rand()%114+14;
k=rand()%13+1;
m=8;
l=7;
for(i=1;i<=99;i++,k++)
{
if(i%9==0)printf("%2d-%c ",i,j);
else printf("%2d-%c ",i,k+13);
if(i%l==0){printf("\n");l+=m;m++;}
}
printf("\n\n任意想一个1~99之间的数,用它本身减去它的个位与十位之和,");
printf("所得到的数,你看看上面的表,有一个对应图案,");
printf("看好这个对应图案后按“y”,我就知道你想什么。\n");
reply2=getch();
if(reply2=='y')printf("\nIt is surely %c Right?\n",j);
else printf("\nBelieve it or not.\n");
printf("\nTry again?(y/other)");
reply1=getch();
printf("\n");
}
printf("Bye!\n");
}