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