Untitled
soal 1 google driveunknown
java
a year ago
660 B
16
Indexable
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Masukkan jumlah baris: ");
System.out.println();
int rows = 3;
int column =5;
// Nested loop untuk menghasilkan pola
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= column; j++) {
if(i==2 && j==3){
System.out.print(" ");
}else{
System.out.print("*");
}
}
System.out.println();
}
scanner.close();
}
}
Editor is loading...
Leave a Comment