package liu0912;
public class Sanjiao {
public static void main(String[] args) {
for(int i=1;i<=5;i++)
{
for(int j=1;j<i;j++)
{
System.out.print("*");
}
System.out.println();
}
}
}
package liu0912;
public class Lingxing
{
public static void main(String[] args)
{
System.out.println("题目五:控制台输出三角形和菱形");
System.out.println("合体输出如下:");
for(int i=1;i<=5;i++)
{
for(int y=1;y<=6-i;y++)
{
System.out.print("* ");
}
for(int y=1;y<=i;y++)
{
System.out.print("$ ");
}
for(int y=1;y<i;y++)
{
System.out.print("$ ");
}
for(int y=1;y<=6-i;y++)
{
System.out.print("* ");
}
System.out.println();
}
for(int i=1;i<=4;i++)
{
for(int y=1;y<=i+1;y++)
{
System.out.print("* ");
}
for(int y=1;y<=5-i;y++)
{
System.out.print("$ ");
}
for(int y=1;y<=4-i;y++)
{
System.out.print("$ ");
}
for(int y=1;y<=i+1;y++)
{
System.out.print("* ");
}
System.out.println();
}
}
}