题解 | #牛牛的字符菱形#
牛牛的字符菱形
https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char ch = in.next().charAt(0);
for(int i=1;i<=5;i++)
{
int a=Math.abs(3-i);
int b=5-2*a;
for(int j=0;j<a;j++)
{
System.out.printf(" ");
}
for(int j=0;j<b;j++)
{
System.out.printf("%c",ch);
}
System.out.println();
}
}
}
传音控股公司福利 337人发布
