Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. public class StairsAndPeople {
  2.  
  3. public static final int stairNum = 5;
  4.  
  5. public static void main(String[] args) {
  6. for (int i = 1; i < stairNum + 1; i++) {
  7. for (int j = 0; j < (5 * (stairNum + 1 - i) - 5); j++) {
  8. System.out.print(" ");
  9. }
  10.  
  11. System.out.print(" " + (char) 153 + " ");
  12.  
  13. for (int j = 0; j < 5; j++) {
  14. System.out.print("*");
  15. }
  16.  
  17. System.out.print("*");
  18.  
  19. for (int j = 0; j < (i - 1) * 5; j++) {
  20. System.out.print(" ");
  21. }
  22.  
  23. System.out.print("*");
  24. System.out.println("");
  25. for (int k = 0; k < (5 * (stairNum + 1 - i)) - 5; k++) {
  26. System.out.print(" ");
  27. }
  28. System.out.print(" /|\\ ");
  29. for (int k = 0; k < 1; k++) {
  30. System.out.print("*");
  31. }
  32. for (int k = 0; k < (i) * 5; k++) {
  33. System.out.print(" ");
  34. }
  35.  
  36. System.out.print("*");
  37. System.out.println("");
  38. for (int k = 0; k < (5 * (stairNum + 1 - i)) - 5; k++) {
  39. System.out.print(" ");
  40. }
  41.  
  42. System.out.print(" / \\ ");
  43. for (int k = 0; k < 1; k++) {
  44. System.out.print("*");
  45. }
  46. for (int k = 0; k < (i) * 5; k++) {
  47. System.out.print(" ");
  48. }
  49.  
  50. System.out.print("*");
  51. System.out.println("");
  52. }
  53. bottomLine();
  54. System.out.println("");
  55. }
  56.  
  57. public static void bottomLine() {
  58. for (int i = 0; i < ((stairNum + 1) * 5) + 2; i++) {
  59. System.out.print("*");
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement