Filling the array according to the rule - 1
Problem
Given a non-negative number
N
- the number of array elements (
N<=20
). Write a program that fills an array with elements according to the following rule:
1 2 4 8 16 32 ...
Display the elements of this array on the screen in one line separated by a space.
Examples
# |
Input |
Output |
1 |
5 |
1 2 4 8 16 |