#include<stdio.h> #include<stdlib.h> #include<time.h> #define N 5 #define N1 374 #define N2 465 int main() { int number; int i; srand(time(0)); for (i = 0; i < N; i++) { number = rand() % (N2 - N1 + 1) + N1; printf("202383290376%04d\n", number); } return 0; }
#include<stdio.h> #include<stdlib.h> int main() { char light; while(scanf("%c",&light)!=EOF) { switch(light) { case 'r':printf("stop!\n");break; case 'g':printf("go go go\n");break; case 'y':printf("wait a minute\n");break; defualt :printf("something must be wrong...\n"); } } return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { srand(time(0)); int x; int a=rand()%30+1; printf("猜猜2023年11月哪一天会是你的lucky day\n"); printf("开始喽,你有三次机会,猜吧(1~30):"); for (int i=1;i<=3;++i){ scanf("%d",&x); if (x<a) printf("你猜的日期早了,你的lucky day还没到呢\n再猜(1~30):"); else if (x>a) printf("你猜的日期晚了,你的lucky day已经过啦\n再猜(1~30):"); else printf("哇,猜中了"); } if (x != a) printf("次数用完啦,偷偷告诉你:11月,你的lucky day是%d号", a); return 0; }
#include<stdio.h> #include<math.h> int main() { int n, a; while(scanf("%d%d", &n, &a) != EOF) { double s = 0; double down = 0; for (int i = 1; i <= n; ++i) { down += pow(10, i - 1) * a; s += i / down; } printf("n=%d,a=%d,s=%f", n, a, s); } }
#include<stdio.h> int main() { int i,j; for(i=1;i<=9;i++) { for(j=1;j<=i;j++) printf("%d*%d=%-5d",j,i,j*i); printf("\n"); } }
标签:include,int,number,实验,printf,go,main From: https://www.cnblogs.com/yukinoshita-/p/17769115.html