public class VeHinh
{
public static void main(String[] args)
{
int row=7;
int col=7;
System.out.println("Images 1");
for(int i=1;i<=row;i++)
{
if(i==1||i==row)
{
for(int l=1;l<=col;l++)
{
System.out.print("* ");
}
System.out.println();
}
if(i!=1&&i<row)
{
for(int j=1;j<i;j++)
{
System.out.print(" ");
}
System.out.println("*");
}
}
System.out.println("\nImages 2");
for(int i=1;i<=row;i++)
{
if(i==1||i==row)
{
for(int l=1;l<=col;l++)
{
System.out.print("* ");
}
System.out.println();
}
if(i!=1&&i<row)
{
for(int j=1;j<=col-i;j++)
{
System.out.print(" ");
}
System.out.print("*");
for(int k=1;k<i;k++)
{
System.out.print(" ");
}
System.out.println();
}
}
}
}
Kết quả:
0 comments:
Post a Comment