Code
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();
}
}
}
or you can view pastebin:
https://pastebin.com/JicXCK1Y^is not giving the output it should..... supposed to be a pyramid.
/EDIT NVM FIGURED IT OUT. Shoulda been print instead of println. Thanks
This post was edited by ferf on Feb 17 2020 07:18pm