Hi Aman !
Thanks for posting comments ! As far as I remember, you have asked for this pattern :
# # # #
#@@@#
#@@@#
#@@@#
# # # #
(Sorry, for the bad indentation, Blogger indents are different from those in Java Terminal Window)
Here's your program :
class pattern_40
{
public static void print(int a)
{
int i,j;
for(i=1;i<a;i++)
System.out.print("#");
System.out.print("\n");
for(i=1;i<a-1;i++)
{
System.out.print("#");
for(j=1;j<a-1;j++)
System.out.print("@");
System.out.print("#");
System.out.print("\n");
}
for(i=1;i<a;i++)
System.out.print("#");
}
}
I have made it such that you can form a pattern for any range that you pass as a parameter into the variable "a". If you find any mistakes, or if this program is not the way you meant it to be, then please comment the same way. Thanks for contributing a nice Java question to this blog.
Regards,
ICSE Java.
Thanks for posting comments ! As far as I remember, you have asked for this pattern :
# # # #
#@@@#
#@@@#
#@@@#
# # # #
(Sorry, for the bad indentation, Blogger indents are different from those in Java Terminal Window)
Here's your program :
class pattern_40
{
public static void print(int a)
{
int i,j;
for(i=1;i<a;i++)
System.out.print("#");
System.out.print("\n");
for(i=1;i<a-1;i++)
{
System.out.print("#");
for(j=1;j<a-1;j++)
System.out.print("@");
System.out.print("#");
System.out.print("\n");
}
for(i=1;i<a;i++)
System.out.print("#");
}
}
I have made it such that you can form a pattern for any range that you pass as a parameter into the variable "a". If you find any mistakes, or if this program is not the way you meant it to be, then please comment the same way. Thanks for contributing a nice Java question to this blog.
Regards,
ICSE Java.