mercredi 30 janvier 2019

I'm wondering how to turn this city in java made of asterisks 90 degrees (so it actually looks like a city)

public class HelloWorld {

 public static void main(String []args)
 {
   int[] arr = {5,10,23,6,9};
    for(int i = 0; i<arr.length; i++)
    {

        for( int j = 0; j< arr[i]; j++)
        {
            System.out.print("*");

        } 

        System.out.println();
    }
 }

}

That is my code, however, it prints the city horizontally, while I'd like it to print vertically. Any thoughts.

Aucun commentaire:

Enregistrer un commentaire