Created
September 21, 2016 01:09
-
-
Save mkdika/8f6d15144699a8eb4a3c20c7f965037f to your computer and use it in GitHub Desktop.
This file contains 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
public class KompasChallange { | |
public static void main(String[] args) { | |
int x = 30; // banyaknya baris yang diinginkan | |
int i = ((x * 2) - 1), n = 0; | |
while (i > 0) { | |
for (int j = 0; j < ((x + (x - 1))); j++) { | |
String c = ((j >= n && j < (x + (x - 1) - n)) ? "*" : " "); | |
System.out.print(c); | |
} | |
System.out.println(""); | |
if (i <= x) { | |
n--; | |
} else { | |
n++; | |
} | |
i--; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment