import java.io.*;
public class Contoh2 {
public static void main(String[] x) throws IOException{
BufferedReader y=new BufferedReader(new InputStreamReader(System.in));
String n1="";
System.out.print("Masukkan batas : ");
n1 = y.readLine();
int b=Integer.parseInt(n1);
int i=1;
while (i<=b) {
int j=1;
while (j<=i) {
System.out.print(j+" ");
j++;
}
System.out.println("");
i++;
}
for(int k=b-1;k>=1;k--) {
for(int l=1;l<=k;l++)
System.out.print(l+" ");
System.out.println("");
}
}
}
public class Contoh2 {
public static void main(String[] x) throws IOException{
BufferedReader y=new BufferedReader(new InputStreamReader(System.in));
String n1="";
System.out.print("Masukkan batas : ");
n1 = y.readLine();
int b=Integer.parseInt(n1);
int i=1;
while (i<=b) {
int j=1;
while (j<=i) {
System.out.print(j+" ");
j++;
}
System.out.println("");
i++;
}
for(int k=b-1;k>=1;k--) {
for(int l=1;l<=k;l++)
System.out.print(l+" ");
System.out.println("");
}
}
}
Tidak ada komentar :
Posting Komentar