题解 | #牛牛的字符菱形#
牛牛的字符菱形
https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
#include <stdio.h> int main() { char ch = 0; scanf("%c", &ch); for (int i = 1; i <= 5; i++) { switch (i) { case 1: printf("%3c\n", ch); break; case 2: printf("%2c%c%c\n", ch, ch, ch); break; case 3: printf("%1c%c%c%c%c\n", ch, ch, ch, ch, ch); break; case 4: printf("%2c%c%c\n", ch, ch, ch); break; case 5: printf("%3c\n", ch); break; } } return 0; }