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