java - Issue displaying a letter made of asterisks -
i display letter a
made of asterisks. first program ask size of letter , depending on given size scale letter size.
this have far, i'm not sure doing wrong. can see prints 1 line. great.
code:
import java.util.scanner; public class problem7 { public static void main(string[] args) { scanner kbd = new scanner(system.in); int input, size, i; system.out.print("enter size: "); input = kbd.nextint(); while (input <= 1) { system.out.print("enter size: "); input = kbd.nextint(); } (int col = 0; col < input; col++) { (int row = 0; row < input; row++) { if (col == 1 || col == input || row == col) system.out.print("*"); else system.out.print(" "); } } } }
result:
enter size: 5 * ***** * * *
if want new line use:
system.out.print("\n");
Comments
Post a Comment