Advertisement
Guest User

Untitled

a guest
May 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. public class P33 {
  3.  
  4. public static void main(String[] args) {
  5. // TODO Auto-generated method stub
  6.  
  7. // using for loop to output 5 "*"
  8. // using for loop to output 1 space 3 "*" 1 space
  9. // using for loop to output 2 spaces 1 "*" 2 spaces
  10. // *****
  11. // ***
  12. // *
  13. for (int i=0; i<5; i++) {
  14. System.out.print("*");
  15. }
  16. System.out.println();
  17.  
  18. System.out.print(" ");
  19. for (int i=0; i<3; i++) {
  20. System.out.print("*");
  21. }
  22. System.out.println(" ");
  23.  
  24. for (int i=0; i<2; i++) {
  25. System.out.print(" ");
  26. }
  27. System.out.print("*");
  28. for (int i=0; i<2; i++) {
  29. System.out.print(" ");
  30. }
  31. System.out.println();
  32.  
  33.  
  34.  
  35.  
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement