I don't know how to print the second and third row.Please help.
****
* *
* *
****
for(i=1;i<=n;i++)
{
if (i==1)||(i==n)
{
for(j=1;j<=n;j++)
System.out.print(j);
}
else{
//dont know
thank you but no thank you!
class patter
{
public static void main(int n)
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
if(i==1||i==n)
System.out.print("*");
else
{
if(j==1||j==n)
System.out.print("*");
else
System.out.print(" ");
}
System.out.println();
}
}
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加