#include<stdio.h>
#include <math.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 <stdlib.h> #include<stdio.h> #include <math.h> #include <time.h> int main() { int n,i,c; printf("猜猜2022年11月哪一天会是你的lucky day\n"); scanf_s("%d",&n); printf("开始喽,你有三次机会,猜吧(1~30):%d\n",n); srand( time(0) ); c=rand()%30+1; if(n==c) { printf("哇,猜中了\n"); return 0; }else if(n>c){ printf("你猜的日期晚了,你的lucky day已经过啦\n"); }else{ printf("你猜的日期早了,你的lucky day还没到呢\n"); } for(i=1;i<=2;i++) { scanf_s("%d",&n); if(n==c) { printf("哇,猜中了"); return 0; }else if(n>c){ printf("你猜的日期晚了,你的lucky day已经过啦\n"); }else{ printf("你猜的日期早了,你的lucky day还没到呢\n"); } } printf("次数用完了。偷偷告诉你:11月,你的lucky day是%d号",c); system("pause"); return 0; }
#include <math.h> #include <stdlib.h> #include<stdio.h> #include <time.h> int main() { char a; while(scanf_s("%c", &a) != EOF) { if(a=='r') { printf("stop!\n"); }else if(a=='g'){ printf("go go go \n"); }else if (a=='y'){ printf("wait a minute\n"); }else{ printf("something must be wrong...\n"); } getchar(); } system("pause"); return 0; }
#include <math.h> #include <stdlib.h> #include<stdio.h> int main() { int n,a,up; while(scanf_s
("%d %d",&n,&a)!=EOF) { double down=1,sum=0,c; for(up=1;up<=n;up++) { down=down*a; c=up/down; sum+=c; } printf("%f\n",sum); getchar(); } system("pause"); return 0; }
#include<stdio.h> int main() { int i, n, c; for (i = 1; i <= 9; i++) { for (n = 1; n <= i; n++) { c = n * i; printf("%d*%d = %d ", i, n, c); } printf("\n"); } system("pause"); return 0; }
#include <math.h> #include <stdlib.h> #include<stdio.h> int main() { int i,n,o,d; scanf_s("%d",&i); printf("%d\n",i); for(n=1;n<=i;n++){ for(d=1;d<n;d++) { printf(" "); } for(o=1;o<=2*i+1-2*n;o++) { printf(" o "); } printf("\n"); for(d=1;d<n;d++) { printf(" "); } for(o=1;o<=2*i+1-2*n;o++) { printf("<H>"); } printf("\n"); for(d=1;d<n;d++) { printf(" "); } for(o=1;o<=2*i+1-2*n;o++) { printf("I I"); } printf("\n"); } system("pause"); return 0; }
标签:int,lucky,else,实验,printf,include,day From: https://www.cnblogs.com/wgc20030213/p/16816328.html