daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package herout;
  7. import java.util.Scanner;
  8.  
  9. /**
  10.  *
  11.  * @author empty
  12.  */
  13. public class Obdlznik {
  14. public static void main(String[] args) {
  15.     Scanner sc = new Scanner(System.in);
  16.     System.out.println("zadajte dlzku:");
  17.     int d = sc.nextInt();
  18.     System.out.println("zadajte sirku:");
  19.     int s = sc.nextInt();
  20.     for(int i = 0; i<s; i++){
  21.         for(int j =0; j<d; j++){
  22.             if(i>0 && i<(s-1)){
  23.                 if((j==0) || (j==(d-1))){
  24.                     System.out.print("*");
  25.                 } else {
  26.                     System.out.print(" ");
  27.                 }
  28.                
  29.             } else {
  30.                 System.out.print("*");
  31.             }
  32.         }
  33.         System.out.print("\n");
  34.        
  35.     }
  36. }
  37. }
RAW Paste Data
Top