Note that there are some explanatory texts on larger screens.

plurals
  1. POeasy java code,printing stars
    text
    copied!<p>here is java code that prints triangles one below each other, naming them A, B, C, D; my question is how to print them on*<em>the same level</em>*</p> <pre><code>public class ex_5_10 { public static void main(String args[]){ // (A) System.out.println("(A)") ; for(int row = 0 ; row &lt; 10 ; row++){ for(int column = 0 ; column &lt; 10 ; column++){ if(column &gt; row) continue ; System.out.print("*"); } System.out.println() ; } //********************************* // (B) System.out.println("(B)") ; for(int row = 0 ; row &lt; 10 ; row++){ for(int column = 0 ; column &lt; 10 ; column++){ if(column &lt; row) continue ; System.out.print("*"); } System.out.println() ; } //******************************** //(C) System.out.println("(C)") ; for(int row = 0 ; row &lt; 10 ; row++){ for(int column = 0 ; column &lt; 10 ; column++){ if( column &lt; row ) System.out.print(" ") ; else System.out.print("*"); } System.out.println() ; } // (D) System.out.println("(D)") ; for(int row = 0 ; row &lt; 10 ; row++){ for(int column = 10 ; column &gt;= 0 ; column--){ if( column &gt; row ){ System.out.print(" ") ; } else {System.out.print("*"); } } System.out.println() ; } } </code></pre> <p>}</p> <p>so the java code above will print this: </p> <pre><code>* ** *** *** ** * *** ** * * ** *** </code></pre> <p>now i need to print same figures on the same level! </p> <pre><code>* *** *** * ** ** ** ** *** * * *** </code></pre> <p>please help me! i m looking for your answer! thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload