Guest User

Untitled

a guest
Jun 24th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. package javaapplication1;
  2. import java.util.*;
  3.  
  4. public class JavaApplication1 {
  5.     public static void main(String[] args) {
  6.         Scanner Wejscie = new Scanner(System.in);
  7.         boolean stan=true;
  8.        
  9.         while(stan){
  10.             int ilosc=0;
  11.  
  12.             while(ilosc<1 || ilosc>4){
  13.                 System.out.println("Podaj ilosc slupkow: ");
  14.                 ilosc=Wejscie.nextInt();
  15.             }
  16.  
  17.             int[] Tablica = new int[ilosc];
  18.  
  19.             for(int i=0; i<Tablica.length; ++i){
  20.                 System.out.println("Podaj dlugosc slupka "+(i+1));
  21.                 Tablica[i]=Wejscie.nextInt();
  22.             }
  23.  
  24.             for(int i: Tablica){
  25.                 for(int z=0; z<3; ++z){
  26.                     System.out.print("| ");
  27.                     for(int j=0; j<i; ++j)
  28.                         System.out.print("#");
  29.                     System.out.print("\n");    
  30.                 }
  31.                 System.out.print("\n");
  32.             }
  33.            
  34.             System.out.println("Kolejna tura (t/n)?");
  35.            
  36.             String whatEver = Wejscie.next();
  37.             char literka = whatEver.charAt(0);
  38.            
  39.             if(literka=='n')
  40.                 stan=false;
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment