You are on page 1of 3

Oleh :

1. Anjar Rokhmi
2. Fauziah Husnaa
3. Muhammad Rasyid

11520241014
11520241015
11520241016

package Algoritma;
import java.util.Scanner;
public class AlgoNomorTiga {
public static void main(String []args){
int a,b,c,d,e,f,jumlah;
String pilih;
Scanner input = new Scanner (System.in);
do{
do{
System.out.println("------------------------");
System.out.print("Masukkan jumlah data : ");
jumlah=input.nextInt();
a=jumlah%2;
if(a==0){
System.out.println("!!!!!!!!!!!!!!!!!>.<!!!!!!!!!!!!!!!!!");
System.out.println("Angka yang di Inputkan harus ganjil");
}
}
while(a==0);
b=jumlah/2;
for(c=1; c<=b+1; c++){
f=(2*c)-1;

for(e=1; e<=f; e++){


System.out.print("*");

}
System.out.println();
}

for(c=b; c>=1; c--){


d=(2*c)-1;

for(e=d; e>=1; e--){


System.out.print("*");
}
System.out.println();
}
System.out.print("Mau Ngulang Lagi Gak . . . ??? (y/t) : ");
pilih = input.next();
}
while (pilih.equals("y"));
}
}

You might also like