题解 | #牛牛的字符菱形#
牛牛的字符菱形
http://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); char ch = myScanner.next().charAt(0); for(int i = 0; i < 3 ;i++) { for(int j = 0; j < 2-i ;j++) { System.out.print(' '); } for(int k = 0; k < 2 * i + 1 ;k++) { System.out.print(ch); } System.out.println(""); } for(int i = 0; i < 2 ;i++) { for(int j = 0; j < i+1 ;j++) { System.out.print(' '); } for(int k = 0; k < 2*(2-i)-1 ;k++) { System.out.print(ch); } System.out.println(""); } } }