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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -