题解 | #牛牛的字符菱形#
牛牛的字符菱形
https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
#include <stdio.h> int main() { char a = getchar(); int i = 0; int N = 1; for(i = 1; i <= 5; i++) { int M = (3-i)*(3-i > 0 ? 1 : -1); for(int m = 0; m < M; m++) { printf(" "); } if(i <= 3) { for(int n = 0; n < N; n++) { printf("%c",a); } } else if(i > 3) { for(int n = 0; n < 10 - N; n++) { printf("%c",a); } } N+=2; printf("\n"); } return 0; }