Loops : Hollow_Rectangle FAROOQ
import java.util.*;
public class day2{
//Funtion to print hollowrectangle
public static void hollowbox(int n){
for(int i=1; i<=n; i++) // i reps to rows
{
System.out.println(""); //outer loop starts in next line
for(int j=1;j<=5;j++) //j reps to columns
if(i==1||j==1||i==n||j==5) //when condition true star print
{
System.out.print("*");
}else
{
System.out.print(" "); //empty space is mand*tory or space occupied by *
}
}
}
public static void main(String args[]){
Scanner sf=new Scanner(System.in);
System.out.println("Enter no. of rows of box");
int rows=sf.nextInt();
System.out.println("#####");
hollowbox(rows);
}
}