#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-1+1)+N1; printf("202383290376%04d\n",number); } return 0; }
#include<stdio.h> #include<stdlib.h> int main() { char x; while(scanf("%c",&x)!=EOF) { getchar(); if(x=='r') printf("stop\n"); else if(x=='y') printf("wait a minute\n"); else if(x=='g') printf("go go go\n"); else printf("something must be wrong\n"); } return 0; }
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int day; srand(time(0)); day=rand()%30+1; int chance; int guess; printf("猜猜2023年11月哪一天会是你的lucky day,你有三次机会:"); for(chance=3;chance>0;chance--){ scanf("%d",&guess); if(guess==day){ printf("right!\n"); return 0; } else if(guess>day){ printf("too late!\n"); } else if(guess<day){ printf("too early!\n"); } else{ printf("再猜:"); } } return 0; }
#include<stdio.h> int main() { int n,a; int i; double s=0; while(scanf("%d%d",&n,&a)!=EOF){ int l=1; double sum=0; for(i=1;i<=n;i++){ s=(i*1.0)/(a*1*1.0); sum=sum+s; l=l*10+1; } printf("n=%d,a=%d,s=%lf\n",n,a,sum); } }
#include<stdio.h> int main() { int n=9; int i=1; int j; while(i<=n){ j=1; while(j<=i){ if(j*i<10){ printf("%d%d=%d",j,i,j*i); } else{ printf("%d%d=%d",j,i,j*i); } j++; } i++; printf("\n"); } return 0; }
#include<stdio.h> int main() { int n; scanf("%d",&n); int n1=n; int s; int space; for(n=n;n>0;n--){ for(space=n1-n;space>0;space--){ printf("\t"); } for(s=2*n-1;s>0;s--){ printf(" 0\t"); } printf("\n"); for(space=n1-n;space>0;space--){ printf("\t"); } for(s=2*n-1;s>0;s--){ printf("<H>\t"); } printf("\n"); for(space=n1-n;space>0;space--){ printf("\t"); } for(s=2*n-1;s>0;s--){ printf("I I\t"); } for(space=n1-n;space>0;space--){ printf("\t"); } printf("\n"); } return 0; }
标签:main,space,int,--,实验,printf,include From: https://www.cnblogs.com/u329089/p/17810648.html