+ 2
While Loop
Hello! I need to write a code that displays: 1 12 123 1234... depending on the number of rows. I wrote the code attached, but don’t know how to modify it to output what i have written above. It has to be two nested while loops! Thanks! https://code.sololearn.com/c42n6s0Bcd1M/?ref=app
3 Respostas
+ 3
ok, it should be a simple modification
just change
for (int i = 0; i <= numRows; i++)
{
...
}
to
int i = 0;
while (i <= numRows)
{
...
i++;
}
and do the same process for the inner loop.
+ 2
I changed it to a for loop which makes more sense here:
https://code.sololearn.com/cFDmKMNcT9yb/?ref=app
+ 1
Oh, sorry, i forgot to mention it has to be two nested while loops. i know a for loop would be better in this case, but my professor wants while loops.