d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Pyramid Pattern Gone Wrong
Add Reply New Topic New Poll
Member
Posts: 31,293
Joined: Mar 25 2009
Gold: 0.00
Feb 17 2020 07:15pm
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
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll