Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.stevehecker.starpattern;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- System.out.println("Enter number of digits for star pattern: ");
- Scanner scan = new Scanner(System.in);
- int amount = scan.nextInt();
- for(int i = 1; i <= amount; i++) {
- for(int j=0; j < i; j++) {
- System.out.println("*");
- }
- System.out.println();
- }
- for (int i=amount -1; i > 0; i--) {
- for(int j=0; j < i; j++) {
- System.out.println("*");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement