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. // your code goes here
  13. Scanner s=new Scanner(System.in);
  14. int count=s.nextInt();
  15. for(int i=1;i<=count;i++)
  16. {
  17. if(i%2==0)
  18. {
  19. for(int k=i;k>=1;k--)
  20. {
  21. System.out.print(k);
  22. }
  23. System.out.print("*");
  24. }
  25. else
  26. {
  27. System.out.print("*");
  28. for(int j=1;j<=i;j++)
  29. {
  30. System.out.print(j);
  31. }
  32. }
  33. System.out.println();
  34. }
  35. }
  36. }
Success #stdin #stdout 0.06s 4386816KB
stdin
6
stdout
*1
21*
*123
4321*
*12345
654321*