Skip to content

Instantly share code, notes, and snippets.

@gusmantap
Created November 15, 2019 06:22
Show Gist options
  • Save gusmantap/e49be4eaed97534e8e3ac1d683ef49b2 to your computer and use it in GitHub Desktop.
Save gusmantap/e49be4eaed97534e8e3ac1d683ef49b2 to your computer and use it in GitHub Desktop.
Segitiga piramid
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package latihan;
/**
*
* @author Bagus
*/
public class Segitiga {
public static void main(String [] args){
for(int y = 0; y < 4; y++){
// System.out.print("Y"+y);
for(int x = 3; x > (y); x--){
if(y != 0){
System.out.print("* ");
}
}
for(int a = 0; a < y; a++){
System.out.print("# ");
}
for(int a = 1; a < y; a++){
System.out.print("# ");
}
for(int x = 3; x > (y); x--){
if(y != 0){
System.out.print("* ");
}
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment