describe
Given a character, use it to construct a rhombus whose diagonal is 5 characters long and placed obliquely.
enter
The input is only one line, containing one character.
output
The characters form a rhombus.
sample input
*
sample output
* *** ***** *** *
Idea: Similar to the character triangle.
public class Main09 {
public static void main(String[] args) {
java.util.Scanner s = new java.util.Scanner(System.in);
char ch = s.next().charAt(0);
System.out.print(" "+ch +"\n"+" "+ch+ch+ch+"\n"+ch + ch + ch +ch + ch+"\n"+" "+ch+ch+ch+"\n"+" "+ch);
//错误演示,原因可以自行查阅,这里不做赘述
//System.out.println(ch + ch + ch +ch + ch +"\n"+" "+ch+ch+ch+"\n"+" "+ch );
}
}