Advertisement
Kancho

Star_Frame

Jan 28th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class pattern {
  4. public static void main(String[] args) {
  5.  
  6. Scanner keyboard = new Scanner(System.in);
  7. System.out.print("Enter size: ");
  8. int s = keyboard.nextInt();
  9.  
  10. for (int i = 1; i <= s; i++) {
  11. for (int j = 1; j <= s; j++) {
  12. if ((i == 1 || i == s) || (j == 1 || j == s)){
  13. System.out.print("*");
  14. }else {
  15. System.out.print(" ");
  16. }
  17.  
  18. }
  19. System.out.println();
  20. }
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement