Java Nested loops: Indent text -


can me solve problem?

print numbers 0, 1, 2, ..., usernum shown, each number indented number of spaces. each printed line, print leading spaces, number, , newline. hint: use , j loop variables (initialize , j explicitly). note: avoid other spaces spaces after printed number. ex: usernum = 3 prints:

the code given follows:

public class nestedloop {  public static void main (string [] args) {    int usernum  = 0;   int = 0;   int j = 0;    /* solution goes here  */    return; } } 

any suggestions appreciated. thank you.

i don't think i , j necessary in sense...

for (int = 0; <= usernum; i++) {     (int j = 0; j < i; j++) {         system.out.print(" ");     }     system.out.println(i); } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -