Advertisement
Guest User

jc12126437

a guest
Apr 26th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. package javaapplication5;
  2.  
  3. import java.util.Scanner;
  4. public class JavaApplication5 {
  5.  
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8. System.out.print("Masukkan Banyak Bintang : ");
  9. int input = scan.nextInt();
  10. {
  11. for (int i=1; i <= input ; i++)
  12. {
  13. if (i != 1 && i != input)
  14. {
  15. for (int j=1; j <= input ; j++)
  16. {
  17. if (j>1 && j<input)
  18. {
  19. System.out.print(" ");
  20. }
  21. else
  22. {
  23. System.out.print(" *");
  24. }
  25. }
  26. }
  27. else
  28. {
  29. for (int x=1; x <= input ; x++)
  30. {
  31. System.out.print(" *");
  32. }
  33. }
  34.  
  35. System.out.print(" \n");
  36. }
  37. }
  38.  
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement