Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ////////////// Фигура /////////////
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Figure {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. String star = "*";
  10. int i;
  11. int j;
  12. int x;
  13.  
  14. Scanner sc = new Scanner(System.in);
  15. System.out.print("Введите высоту фигуры: ");
  16. int num = sc.nextInt();
  17.  
  18. for (i = 0; i < num; i++) {
  19. for (j = 0; j <= i; j++)
  20.  
  21. System.out.print(star);
  22.  
  23. System.out.println();
  24.  
  25. }
  26. for (i = num; i > 0; i--) {
  27. for (x = i; x > 1; x--) {
  28.  
  29. System.out.print(star);
  30. }
  31. System.out.println();
  32. }
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement