Buat gambar rumah masih newbie ane gan..............
import java.util.*;
public class b6
{
public static void main(String[] args)
{
Scanner hni = new Scanner(System.in);
System.out.print("Masukkan tinggi : ");
int n = hni.nextInt();
System.out.println("");
for(int i=1;i<=n;i++)
{
for(int j=1 ;j<=n-i;j++)
System.out.print(" ");
for(int k=1;k<=2*i-1;k++)
System.out.print("1");
for(int l=1; l<=(3*n);l++)
System.out.print("_|");
System.out.println("");
}
for(int i=1;i<=n;i++)
{
for(int j=1 ;j<=1;j++)
System.out.print("|");
for(int k=1; k<=2*n-3;k++)
System.out.print(" ");
System.out.print("|");
for(int p=1; p<=6*n-1;p++)
System.out.print(" ");
System.out.print("|");
System.out.println("");
}
for(int q=1; q<=8*n-1;q++){
System.out.print("=");
}
}
}
public class b6
{
public static void main(String[] args)
{
Scanner hni = new Scanner(System.in);
System.out.print("Masukkan tinggi : ");
int n = hni.nextInt();
System.out.println("");
for(int i=1;i<=n;i++)
{
for(int j=1 ;j<=n-i;j++)
System.out.print(" ");
for(int k=1;k<=2*i-1;k++)
System.out.print("1");
for(int l=1; l<=(3*n);l++)
System.out.print("_|");
System.out.println("");
}
for(int i=1;i<=n;i++)
{
for(int j=1 ;j<=1;j++)
System.out.print("|");
for(int k=1; k<=2*n-3;k++)
System.out.print(" ");
System.out.print("|");
for(int p=1; p<=6*n-1;p++)
System.out.print(" ");
System.out.print("|");
System.out.println("");
}
for(int q=1; q<=8*n-1;q++){
System.out.print("=");
}
}
}
output :
0 komentar:
Posting Komentar