Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication5;
- import java.util.Scanner;
- public class JavaApplication5 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- System.out.print("Masukkan Banyak Bintang : ");
- int input = scan.nextInt();
- {
- for (int i=1; i <= input ; i++)
- {
- if (i != 1 && i != input)
- {
- for (int j=1; j <= input ; j++)
- {
- if (j>1 && j<input)
- {
- System.out.print(" ");
- }
- else
- {
- System.out.print(" *");
- }
- }
- }
- else
- {
- for (int x=1; x <= input ; x++)
- {
- System.out.print(" *");
- }
- }
- System.out.print(" \n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement