题解 | #牛牛的字符菱形#
牛牛的字符菱形
https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
#include <stdio.h> int main() { int arr[5] = {1, 3, 5, 3, 1}; char a = 0; scanf("%c",&a); int i = 0; int j = 0; for(i = 0; i < 5; i++) { if(arr[i] == 1) { printf(" "); } else if(arr[i] == 3) { printf(" "); } for(j = 0; j < arr[i]; j++) { printf("%c",a); } printf("\n"); } return 0; }