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


