(Solved):Print numbers 0,1,2,…,userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and… View Answer…

 

Question

Print numbers 0,1,2,…,userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline.

Hint: Use i and j as loop variables (initialize i and j explicitly).

Note: Avoid any other spaces like spaces after the printed number.

Ex: userNum= 3prints.

  1. 0
  2.  1
  3.   2
  4.    3
Scroll to top