# INTRN109-Editorial

http://campus.codechef.com/INTRNTS/problems/INTRN109/

CAKE-WALK

### PREREQUISITES:

You have to input a number n. Your task is to output n lines of a series given as

2

2 4

2 4 8

### QUICK-EXPLANATION:

The ith line for a given n contains the series of numbers whose kth element will be 2^{k}.
For example the 5th line would look like

2 4 8 16 32

### EXPLANATION:

For a given n , there exists n lines of output. Each line in the output denotes a series of numbers. All of the series have the same first element 2 and all of them have the same common ratio 2. The only difference between each line of output is number of elements in each line. The number of elements is equal to the line number in output, as in the first line will have only one element, the second line will have two elements and so on. This problem can be solved using a nested for loop. The pseudo-code would look something like this,

``````    for(i = 0;i < n ; i++)
{
for(j=0;j<=i;j++)
print 2^(j+1);
}
``````

The output for n=5 would be

2

2 4

2 4 8

2 4 8 16

2 4 8 16 32

### AUTHOR AND TESTER’S SOLUTION:

Tester’s Solutioun