#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; }
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int number; int n, i; srand(time(0)); number = rand() % 30 + 1; printf("猜猜那一天会是你的Lucky day\n"); printf("开始喽,你有三次机会,猜吧(1~30)\n"); for (i = 1; i <= 3; i++) { scanf("%d", &n); if (n == number) { printf("你猜中了"); break; } if (n < number) { printf("你猜的日期早了,Lucky day还没到呢\n"); } if (n > number) { printf("你猜的日期晚了,Lucky day已经过啦\n"); } if (i == 3) { printf("次数用光啦,偷偷告诉你:11月,你的Lucky day是%3d号\n", number); break; } if (i <= 2) { printf("再猜:\n"); } } return 0; }
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { char x; while (scanf(" %c", &x ) != EOF) { switch (x) { case 'y':printf("wait a minute\n"); break; case 'g':printf("go go go\n"); break; case 'r':printf("stop\n"); break; default:printf("something must be wrong..."); } } return 0; }
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int a,n,i; double s=0,t=0; while (scanf("%d,%d",&n,&a)!=EOF) { printf("n=%d,a=%d,", n, a); for (i = 1; i <= n; ++i) { t = t * 10 + a; s = s + i / t; } printf("s=%lf\n", s); s = 0; t = 0; } return 0; }
#include<stdio.h> int main() { int x, y; for (x = 1; x <= 9; x++) { for (y = 1; y <= x; y++) printf("%dx%d=%2d", x, y, x * y); printf("\n"); } return 0; }
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int i, m, n; scanf("%d", &n); for (i = 1; i <= n; i++) { for (m = 1; m < i; m++) { printf(" \t"); } for (m = 1; m <= 2 * (n - i) + 1; m++) { printf(" O \t"); } printf("\n"); for (m = 1; m < i; m++) { printf(" \t"); } for (m = 1; m <= 2 * (n - i) + 1; m++) { printf("<H>\t"); } printf("\n"); for (m = 1; m < i; m++) { printf(" \t"); } for (m = 1; m <= 2 * (n - i) + 1; m++) { printf("I I\t"); } printf("\n"); printf("\n"); } return 0; }
标签:include,int,number,实验,printf,main,define From: https://www.cnblogs.com/0253yyf/p/16824524.html