#include<stdio.h> #include<stdlib.h> #include<time.h> #define N 5 #define N1 347 #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> int main() { char n; while(scanf("%c",&n)!=EOF) { getchar(); switch(n) { case 'r' : printf("srop!\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");break; } } return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int day,n,i; srand(time(0)); day=rand()%(30)+1; printf("猜猜11月的那一天是你的lucky day\n"); printf("开始喽,你有三次机会,猜吧(0~30):"); for (i=1;i<=3;i++) { scanf("%d",&n); if (n<day) printf("你的日期早了,你的lucky day还没到呢\n再猜(0~30):"); else if(n=day) printf("哇,猜中了:-)"); else printf("你的日期晚了,你的lucky day已经过啦\n再猜(0~30):"); } if (n!=day) printf("次数用完啦。偷偷告诉你,11月,你的lucky day是%d号",day); return 0; }
#include<stdio.h> #include<math.h> int main() { int n,a; while(scanf("%d%d",&n,&a)!=EOF) {
double down=0,s=0; int i; for(i=1;i<=n;++i) { down+=pow(10,i-1)*a; s+=i/down; } printf("n=%d,a=%d,s=%f",n,a,s); } return 0; }
#include<stdio.h> int main() { int line; for(line=1;line<=9;line++) { int i; for(i=1;i<=line;i++) { printf("%d ×%d = %d ",i,line,i*line); } printf("\n"); } return 0; }
#include<stdio.h> int main() { int n = 0; int i; printf("input n :"); scanf("%d", &n); for (i = 1; i <= n; i++) { int a1; for (a1 = 1; a1 <= 2 * i - 2; a1++) { printf(" "); } int a2; for (a2 = 1; a2 <= 2 * n - 2 * i + 1; a2++) { printf(" O "); } printf("\n"); for (a1 = 1; a1 <= 2 * i - 2; a1++) { printf(" "); } for (a2 = 1; a2 <= 2 * n - 2 * i + 1; a2++) { printf("<H> "); } printf("\n"); for (a1 = 1; a1 <= 2 * i - 2; a1++) { printf(" "); } for (a2 = 1; a2 <= 2 * n - 2 * i + 1; a2++) { printf("I I "); } printf("\n\n"); } return 0; }
标签:include,int,break,实验,printf,go,main From: https://www.cnblogs.com/5742TD/p/17767693.html