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.
thank u very much
ReplyDeletewrite a program to input a binary no. and convert it into decimal equivalent
please solve it
I have already posted that program here. The link to the program is :
ReplyDeletehttp://icse-java.blogspot.com/2012/01/to-convert-binary-number-into-decimal.html
i am a student of class 10 going to give my icse this following year could you please suggest me a good book on java that deals with java from its core
ReplyDeleteCan you plase write a program to find if a number is amicable or not?
ReplyDeleteCan you plase write a program to find if a number is amicable or not?
ReplyDeletei am a student of class 10 going to give my icse this following year could you please suggest me a good book on java that deals with java from its core
ReplyDelete