------------恢复内容开始------------
#include <stdio.h> int main() { int num; scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("%d", &num); printf("2049%04d\n", num); return 0; }
#include <stdio.h> int main() { char ans1, ans2; printf("复习了没?(输入y或Y表示复习了,输入n或N表示没复习) : "); ans1 = getchar(); getchar(); printf("\n动手敲代码了吗?(输入y或Y表示敲了,输入n或N表示木有敲) : "); ans2 = getchar(); if (ans1 != ans2) printf("罗马不是一天建成的:)\n"); else printf("\n罗马不是一天毁灭的。。。\n"); return 0; }
#include <stdio.h> int main() { char x; x = getchar(); if (x>='0' && x<='9') printf("%c是数字字符\n", x); else if (x>='A' && x<='Z' || x>='a' && x<='z') printf("%c是英文字母\n", x); else printf("%c是其他字符\n", x); return 0; }
------------恢复内容结束------------
#include<stdio.h> int main() { int n, a; scanf_s("%d%d", &n, &a); printf("n=%d a=%d ", n, a); double sum = 0; double t = a; for (double i = 1; i <= n; i++) { if (i >= 2)t = t * 10 + a; sum += i / t; } printf("%lf", sum); return 0; }
#include<stdio.h> #include <stdlib.h> #include <time.h> const int N = 5; int main() { int x, n; srand(time(0)); for (n = 1; n <= N; n++) { x = rand() % 100; printf("%3d", x); } printf("\n"); return 0; }
#include<stdio.h> #include <stdlib.h> #include <time.h> const int N = 5; int main() { int n; srand(time(0)); printf("猜一猜2021年12月哪一天会是你的lucky day\n开始喽,你有三次机会,猜吧:"); int m= rand() % 30; for(int i=0;i<3;i++) { if (i > 0)printf("再猜:"); scanf_s("%d", &n); if (n == m) { printf("你猜对了"); return 0; } else if (n > m) printf("你猜的日期晚了\n"); else printf("你猜的日期早了\n"); } printf("次数用完啦,悄悄告诉你,你的lucky day是:%d", m); return 0; }
#include<stdio.h> #include <stdlib.h> #include <time.h> const int N = 5; int main() { int n; scanf_s("%d", &n); for(int i=0;i<n;i++) { printf(" O\n"); printf("<H>\n"); printf("I I\n\n"); } return 0; }
#include<stdio.h> #include <stdlib.h> #include <time.h> const int N = 5; int main() { int n; scanf_s("%d", &n); for (int i = 0; i < n; i++) { printf(" O\t"); } printf("\n"); for (int i = 0; i < n; i++) { printf(" <H>\t"); } printf("\n"); for (int i = 0; i < n; i++) { printf(" I I\t"); } printf("\n"); return 0; }
#include<stdio.h> int main() { int i, n, a, b, c; scanf_s("%d", &n); for (a = 0; a < n; a++) { for (b = 0; b < a; b++) printf("\t"); for (i = 0; i < (2 * (n - a) - 1); i++) printf(" O \t"); for (c = 0; c < a; c++) printf("\t"); printf("\n"); for (b = 0; b < a; b++) printf("\t"); for (i = 0; i < (2 * (n - a) - 1); i++) printf("<H>\t"); for (c = 0; c < a; c++) printf("\t"); printf("\n"); for (b = 0; b < a; b++) printf("\t"); for (i = 0; i < (2 * (n - a) - 1); i++) printf("I I\t"); for (c = 0; c < a; c++) printf("\t"); printf("\n"); } return 0; }