Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner scan = new Scanner(System.in);
- System.out.println("Immettere il numero di righe (metΓ del diamante):");
- int n = scan.nextInt();
- for (int a = 1; a <= n; a++) {
- for (int b = 1; b <= a; b++ ) {
- System.out.print("*");
- }
- for (int c = 2; c <= a; c++) {
- System.out.print("*");
- }
- System.out.println();
- }
- for (int j = (n - 1); j > 0; j--) {
- for (int g = j; g > 0; g--) {
- System.out.print("*");
- }
- for (int h = 2; h <= j; h++) {
- System.out.print("*");
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement