import java.util.*;
public class Pattern11 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the no. of rows to be printed: ");
int n= in.nextInt();
for (int i = 0; i <n; i++) {
for (int j = 0; j < n; j++) {
if (i-j==0) {
System.out.print("#");
}
else if (i+j==(n-1)) {
System.out.print("#");
}
else
{
System.out.print(" ");
}
}
System.out.println("");
}
in.close();
}
}
Comments
Post a Comment
THANK YOU FOR COMMENTING !
PLEASE SUBSCRIBE TO OUR WEBSITE FOR LATEST UPDATES