Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package hinh_chu_nhat;
- import java.util.Scanner;
- public class Hinh_Chu_Nhat {
- public static void main(String[] args) {
- Scanner Sc=new Scanner(System.in);
- int a,b;//a dai, b rong
- do
- {
- a=Sc.nextInt();
- b=Sc.nextInt();
- if(a<2||b<2) System.out.print("Nhap lai a va b\n");
- }while(a<2||b<2);
- for(int i=0;i<b;i++)
- {
- for(int j=0;j<a;j++)
- {
- if(j==0||j==(a-1)||i==0||i==(b-1)) System.out.print("#");
- else System.out.print(" ");
- }
- System.out.print("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement