Skip to content

Instantly share code, notes, and snippets.

@mariiaKolokolova
Created May 6, 2020 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariiaKolokolova/3e4e065d9cde621d1bca08e732b4db04 to your computer and use it in GitHub Desktop.
Save mariiaKolokolova/3e4e065d9cde621d1bca08e732b4db04 to your computer and use it in GitHub Desktop.
package maricka.kolokolova;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.println("Input height of the rectangle: ");
int h = sc.nextInt();
System.out.println("Input width of the rectangle: ");
int w = sc.nextInt();
printRectangle(h, w);
sc.close();
}
static void printRectangle(int h, int w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment