Nama file: ExerciseSatu.java
public class ExerciseSatu {
public static void main(String args[]){
for(int i = 0; i < 5; i++ ){
for(int j = 0; j < 6-i-1;j++ ){
System.out.print("*");
}
System.out.println();
}
}
}
Nama file: ExerciseDua.java
package Exercise;
public class ExerciseDua {
public static void main(String args[]){
for(int i = 0; i < 5;i++){
for(int j=0; j<5+i-5; j++ ){
System.out.print(" ");
}
for(int j=0; j<6-i-1; j++){
System.out.print("*");
}
System.out.println();
}
}
}
Nama file: ExerciseTiga.java
public class ExerciseTiga {
public static void main(String args[]){
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5-i-1; j++){
System.out.print(" ");
}
for(int j = 0; j < 2*i+1; j++){
System.out.print("*");
}
System.out.println();
}
for(int i = 0; i < 5; i++){
for(int j = 0; j < 4+i-3; j++){
System.out.print(" ");
}
for(int j = 0; j < 7-(2*i); j++){
System.out.print("*");
}
System.out.println();
}
}
}
Nama file: ExerciseEmpat.java
public class ExerciseEmpat {
public static void main(String args[]){
System.out.println("NtN^3");
for(int i = 1 ; i <=10 ; i++){
System.out.println(i+"t"+(i*i*i));
}
}
}
Selamat mencoba semua percobaan tersebut dan pelajari saja sampai ngerti, kalau tetep nggak ngerti comment aja ntar tak jelasin se ngertiku 😀
Leave a Comment