-
-
Save mariiaKolokolova/3e4e065d9cde621d1bca08e732b4db04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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