fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner keyboard = new Scanner(System.in);
  13. int triangleHeight = keyboard.nextInt();
  14. int i;
  15. int j;
  16. for(i = 1; i < triangleHeight; i++) {
  17. for (j = 1; j <= i; j++) {
  18. System.out.print("*");
  19. }
  20. System.out.println();
  21. }
  22. for(i = triangleHeight; i>=1; i--) {
  23. for (j = i; j >= 1; j--) {
  24. System.out.print("*");
  25. }
  26. System.out.println();
  27. }
  28. }
  29. }
Success #stdin #stdout 0.06s 711680KB
stdin
4
stdout
*
**
***
****
***
**
*