Advertisement
grodek118

Printing a square

Apr 26th, 2022
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. package com.company;
  2.  
  3.  
  4. public class Main {
  5.     public static void main(String[] args) {
  6.         printingSquare(4);
  7.  
  8.     }
  9.     public static void printingSquare(int size) {
  10.         for (int i = 0; i < size; i++){
  11.             printingStars(size);
  12.         }
  13.     }
  14.  
  15.     private static void printingStars(int number) {
  16.         for (int i = 0; i < number; i++) {
  17.             System.out.print("*");
  18.         }
  19.         System.out.println(" ");
  20.     }
  21.  
  22.  
  23.  
  24. }
  25.  
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement