Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package herout;
- import java.util.Scanner;
- /**
- *
- * @author empty
- */
- public class Obdlznik {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("zadajte dlzku:");
- int d = sc.nextInt();
- System.out.println("zadajte sirku:");
- int s = sc.nextInt();
- for(int i = 0; i<s; i++){
- for(int j =0; j<d; j++){
- if(i>0 && i<(s-1)){
- if((j==0) || (j==(d-1))){
- System.out.print("*");
- } else {
- System.out.print(" ");
- }
- } else {
- System.out.print("*");
- }
- }
- System.out.print("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement