How to have a sequence of output using While Loop in Java? : <p>I was confused on how to apply code for while, my input would be;</p>

<pre><code>input: 5
</code></pre>

<p>I was expecting to have this kind of sequence output using while loop;</p>

<pre><code>input: 
5
output:
*****
****
***
**
*
</code></pre>

<p>I applied this code;</p>

<pre><code>int input ;
    String output = "*";

    Scanner sc = new Scanner(System.in);
    System.out.println ("input:");
    input = sc.nextInt();
    System.out.println ("output: ");
    while (input!=0){
        System.out.print (output);
        input--;

    }
</code></pre>

<p>But the output was;</p>

<pre><code>input:
3
output: 
***
</code></pre>
