Skip to content

Instantly share code, notes, and snippets.

@gusmantap
Created November 15, 2019 06:58
Show Gist options
  • Save gusmantap/fba99abecb227735d24d66a8923856cb to your computer and use it in GitHub Desktop.
Save gusmantap/fba99abecb227735d24d66a8923856cb to your computer and use it in GitHub Desktop.
/*
* 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 Belahketupat {
public static void main(String [] args){
for(int y = 0; y < 3; y++){
for(int x = 3; x > y; x--){
if(y != 0){
System.out.print("* ");
}
}
if(y != 3){
for(int a = 0; a < y; a++){
System.out.print("# ");
}
}
if(y != 3){
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();
}
for(int x = 0; x < 5; x++){
System.out.print("# ");
}
System.out.println();
for(int y = 0; y < 2; y++){
for(int x = 0; x < y+1; x++){
System.out.print("* ");
}
for(int x = 2; x > y; x--){
System.out.print("# ");
}
for(int x = 1; x > y; x--){
System.out.print("# ");
}
for(int x = 0; x < (y+1); x++){
System.out.print("* ");
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment