/*Bagi kawan-kawan yang masih bingung cara membuat rumah berikut ada contoh codingan nya monggo dicoba*/
import java.util.Scanner;
public class Rumah {
/*Nama : Fadhil Ikhsan Nurcahyo
*Kelas : 1IA25
*NPM : 53413035
*/
public static void main(String[] args) {
atribut a = new atribut();
a.rumah();
}
}
class atribut {
void rumah(){
Scanner input = new Scanner(System.in);
System.out.print("Masukan tinggi atap : ");
int x = input.nextInt();
//atap
for(int j=1;j<=x;j++){
for(int k=x-1;k>=j;k--){
System.out.print(" ");
}
for(int l=1;l<=j;l++){
System.out.print("*");
}
for(int m=2;m<=j;m++){
System.out.print("*");
}
for(int n=1;n<=x;n++){
System.out.print("\\__");
}
System.out.println("");
}
//tembok
for(int j=1;j<=x;j++){
for(int k=1;k<=x;k++){
if(j==1||j==x||k==1||k==x)
System.out.print("##");
else
System.out.print(" ");
}
for(int l=1;l<=x;l++){
System.out.print("|"+l+"|");
}
System.out.println("");
}
}
}
0 komentar:
Posting Komentar