#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); } return 0; }
#include<stdio.h> #include<stdlib.h> int main() { int day, x, i; day = rand() % 30+1; printf("猜猜2022年11月那一天是你的lucky day\n"); printf("开始咯,你有3次机会,猜吧(1~30):"); for (i = 1; i <= 3; i++) { scanf_s("%d", &x); if (x > day) { printf("你猜的日期晚了,你的lucky day已经过啦\n"); continue; } else if (x < day) { printf("你猜的日期早了,你的lucky day还没到呢\n"); continue; } else if (x == day) { printf("哇,猜中了:)"); break; } }if(x!=day) printf("次数用完啦,偷偷告诉你:11月,你的lucky day是%d号", day); return 0; }
#include<stdio.h> #include<stdlib.h> int main() {char x; for (;;) { scanf_s("%c", &x); getchar(); switch (x) { case 'r':printf("stop!\n"); break; case 'g':printf("go go go\n"); break; case 'y':printf("wait a minute\n"); break; default:printf("some thing must be wrong..."); } }
#include<stdio.h> #include<math.h> int main() { for (;;) { long double n, a; long double s = 0.0000000000; scanf_s("%lf%lf", &n, &a); int i = 1; for (i = 1; i <= n; i++) { s = s + i / pow(a, i); } printf("s=%lf", s); printf("\n"); } return 0;
#include<stdio.h> #include<math.h> int main() { int a, b, sum; for (a = 1; a <= 9; a++) { for (b = 1; b <= 9; b++) { if (b <= a) {sum = a * b; printf("%d*%d=%d\t", a, b, sum); } } printf("\n");} return 0; }
#include<stdio.h> int main() { int n, i,m; printf("Input n:\n"); scanf_s("%d", &n); for (i = 1; i <= n; i++) {for (m = 1; m <= (i-1); m++) { printf("\t"); } for (m = 1; m <= (2 * n - 2*i+1); m++) { printf(" 0 \t"); } printf("\n"); for (m = 1; m <= (i-1); m++) { printf("\t"); }for (m = 1; m <= (2 * n - 2 * i + 1); m++) { printf("<H>\t"); } printf("\n"); for (m = 1; m <= (i-1); m++) { printf("\t"); }for (m = 1; m <= (2 * n - 2 * i + 1); m++) { printf("I I\t"); } printf("\n"); } return 0; }
标签:语句,main,int,编程,lucky,C语言,printf,include,day From: https://www.cnblogs.com/t110e5/p/16824008.html