Created
November 15, 2019 06:22
-
-
Save gusmantap/e49be4eaed97534e8e3ac1d683ef49b2 to your computer and use it in GitHub Desktop.
Segitiga piramid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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