Advertisement
Spocoman

06. Rhombus of Stars

Aug 31st, 2024
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class RhombusOfStars {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.         for (int row = 1; row <= n; row++) {
  8.             System.out.println((" ").repeat(n - row) + ("* ").repeat(row));
  9.         }
  10.         for (int row = n - 1; row > 0; row--) {
  11.             System.out.println((" ").repeat(n - row) + ("* ").repeat(row));
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement