Guest User

Untitled

a guest
May 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1.  
  2.  
  3. int vyska;
  4. int sirka;
  5. final char MEZERA = ' ';
  6. final char ZNAK = '*';
  7. int cislo=0;
  8.  
  9.  
  10.  
  11.  
  12. Scanner vstupKlavesnice = new Scanner(System.in);
  13. System.out.println("Zadej rozmer ");
  14. cislo = vstupKlavesnice.nextInt();
  15. char[][] pole = new char [cislo][];
  16.  
  17. if (cislo<3 | cislo>32) {
  18. System.out.println("Rozmery mohou byt jen 3-32");
  19. }
  20.  
  21.  
  22.  
  23. for (int i=0;i<pole.length;i++) {
  24. pole[i] = new char [i+1];
  25. for (int j=0;j<=i;j++) {
  26. pole [i] [j] = ZNAK;
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. }
  43.  
  44.  
  45.  
  46. for ( int i=0;i<pole.length;i++) {
  47. for (int j=0;j<pole[i].length;j++) {
  48.  
  49. System.out.print(pole[i] [j]);
  50.  
  51. }
  52.  
  53. System.out.println();
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. }
  63. }
  64. }
Add Comment
Please, Sign In to add comment