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)
  11. {
  12. Scanner in = new Scanner(System.in);
  13. //System.out.print("Enter the number of rows: ");
  14. int x = in.nextInt();
  15. //System.out.print("Enter the number of stars: ");
  16. int y = in.nextInt();
  17.  
  18. //loop for x lines
  19. for(int i = x; i > 0; i--){
  20.  
  21. //Insert spaces based on line number
  22. for (int s = 0; s < i; s++)
  23. System.out.print(" ");
  24.  
  25. //Print y stars
  26. for(int j = 0; j < y; j++){
  27. System.out.print("*");
  28. }
  29.  
  30. System.out.println();
  31. }
  32. }
  33. }
Success #stdin #stdout 0.15s 321280KB
stdin
4 6
stdout
    ******
   ******
  ******
 ******