` #include <stdio.h>
include <stdlib.h>
include <time.h>
define N 5
int main()
{
int number;
int i;
srand( time(0) ); // 以当前系统时间作为随机种子
for(i = 0; i < N; ++i) {
number = rand()%65 + 1;
printf("20238331%04d\n", number);
}
getchar();
getchar();
return 0;
}`
`#include<stdio.h>
include<stdlib.h>
int main()
{
char color;
while(1){
scanf("%c",&color);
switch(color){
case 'r':printf("stop!\n");break;
case 'g':printf("go go go\n");break;
case 'y':printf("wait a minute\n");break;
default:printf("domething must be wrong...\n");break;
}
getchar();
}
return 0;
}
`
`#include <stdio.h>
include <stdlib.h>
include <time.h>
int main()
{
int lucky_day;
int guess;
int cnt=1;
srand((unsigned)time(NULL));
lucky_day=rand()%31+1;
while(cnt<=4){
scanf("%d",&guess);
if (guess>lucky_day)
printf("晚了");
if (guess<lucky_day)
printf("早了");
if (guesslucky_day)
{printf("猜中了");
break;
}
if (cnt3)
{
printf("没机会");
break;
}
cnt=cnt+1;
}
getchar();
getchar();
getchar();
getchar();
getchar();
return 0;
}`
`#include<stdio.h>
int main(){
int a,n,down;
double s=0;
int i,j,m=1;
while(1){
scanf("%d %d",&n,&a);
down=a;
for(j=1;j<=n;j++)
{m=m*10;
down=down+a*m;
s=s+j*1.0/down;
}
printf("%lf",s);
}
}`
#include<stdio.h> int main() { int i,n; for(n=1;n<=9;++n) { for(i=1;i<=n;++i){ printf("%d*%d=%d\t",i,n,i*n); } printf("\n"); } getchar(); getchar(); return 0; }
`#include<stdio.h>
int main()
{
int n,i,j,k;
printf("n=");
scanf("%d",&n);
printf("\n");
for(i=n;i>=1;--i)
{
for(k=0;k<(n-i);++k){
printf("\t");
}
for(j=1;j<=(2i-1);++j){
printf(" o\t");
}
printf("\n");
for(k=0;k<(n-i);++k){
printf("\t");
}
for(j=1;j<=(2i-1);++j){
printf("
}
printf("\n");
for(k=0;k<(n-i);++k){
printf("\t");
}
for(j=1;j<=(2*i-1);++j){
printf("I I\t");
}
printf("\n");
}
return 0;
}`