mercredi 5 octobre 2016

Printing star and character triangle in java

Vote count: 0

So i have to create program that outputs a star and the letter o. I have gotten it working for the most part but the output is not 100% correct, minor things really. 
Here is my code so far: 
for(int i = 1; i <=numRows; i++){
                    System.out.print("\n");
                    for(int j = 0; j<=numRows; j++){
                        if(i+j >= numRows){
                            System.out.print('*');
                            System.out.print("o");
                        }else {
                            System.out.print(" ");
                        }
                    }
                    System.out.println();

And here is a screenshot of what the output is supposed to look likeScreenshot of the desired output

asked 10 secs ago

Let's block ads! (Why?)



Printing star and character triangle in java

Aucun commentaire:

Enregistrer un commentaire