Nested loop question
How would I include a nested loop to make the out put of this code look like this
1
12
123
1234
12345... Etc
1 2 3 4 5
|
Cout<< "please input a positive number" <<endl;
Cin<< num;
for(i=1; i<=num; i++)
{cout<< i <<endl;
}
|
You would loop from 1 to i.
By the way, C++ is case sensitive, so Cout is not going to work..
I am aware, I was having to post this off my phone and it auto caps... Would you recommend a for loop for this?
Recommend what? You already have a for loop i = 1 to num. Now you need a for loop j = 1 to i. I bet it will be a lot like the first one..
Topic archived. No new replies allowed.