#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()%500+1; printf("20228329%04d\n",number); } system("pause"); return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int number; int i; srand(time(0)); number=rand()%30+1; printf("猜猜2022年11月哪一天是你的幸运天\n"); printf("开始咯,你有三次机会,猜吧(1-30):"); for(i=1;i<=3;i++){ int a; scanf("%d",&a); if(a==number) {printf("哇,猜中了\n");break;} else {if(a<number) printf("你猜的日期早了\n"); else printf("你猜的日期晚了\n");} } if(i==4) printf("次数用完了,偷偷告诉你,是:%d",number); system("pause"); return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { char i, a,y,r,g; while(scanf("%c",&i)!=EOF) { switch(i) { getchar(); case'r':printf("stop!\n");break; case'g':printf("go go go\n");break; case'y':printf("wait a minute\n");break; default:printf("something must be wrong\n"); } } system("pause"); return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int n,a; double s=0,m=0,i; scanf("%d%d",&n,&a); getchar(); for(i=1;i<=n;i++) { m=m*10+a; s+=i/m; } printf("n=%d,a=%d,s=%lf",n,a,s); system("pause"); return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int i,n,sum; for(n=1;n<=9;n++) { for(i=1;i<=n;i++) { sum=n*i; printf("%d*%d=%d\t",n,i,sum); } printf("\n"); } system("pause"); return 0; }
标签:include,int,number,实验,printf,go,main From: https://www.cnblogs.com/whhnxr/p/16822662.html