grodek118

Printing a rectangle

May 4th, 2022
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. package com.company;
  2.  
  3.  
  4. public class Main {
  5.     public static void main(String[] args) {
  6.         printRectangle(17,3);
  7.     }
  8.  
  9.     public static void printRectangle(int width, int height) {
  10.         for (int i = 0; i < height; i++) {
  11.             for (int j = 0; j < width; j++){
  12.                 System.out.print("*");
  13.             }
  14.             System.out.println("");
  15.         }
  16.     }
  17. }
  18.  
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment