CODING PROBLEMS

how will you write a code if the output is like this?
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3

and..
like this?

1 1 2 3 5 8
how will you write a code if the output is like this?
Two nested loops where the the output is the index of the first loop.

and..
like this?
A single loop where you use variable (like x) to store the result of the addition of the previous two values (like p1, p2) and output that variable. Then p1 = p2 and p2 = x for the next iteration

output:
1
2
std::cout << value;
std::cout << std::endl; // output of a new line 


loop:
1
2
3
4
for(int i = 0; i < count; ++i)
{
  ...
}
thankyou !
Topic archived. No new replies allowed.