jeudi 5 mars 2020

Using For Loop to Print Pattern in Java

I need to print this: enter image description here

I need to print this square using a for loop in java.

This is what I have so far:

 public static void main(String [] args)
   {

    for(int i = 0; i < 5; i++){
              System.out.print("O ");
        }
        System.out.println();
          for(int i = 0; i < 4; i++){
            System.out.print("O ");
        }

    }

Aucun commentaire:

Enregistrer un commentaire