Implement makeCounter() returning a function that returns 1, 2, 3... on successive calls. The input is a single integer n — create ONE counter and call it n times, printing each result on its own line.
Input: one integer n. Output: n lines: 1..n.
Your program reads from stdin and prints to stdout.
Example 1
Input: 3
Output: 1 2 3
Hints
Implement makeCounter() returning a function that returns 1, 2, 3... on successive calls. The input is a single integer n — create ONE counter and call it n times, printing each result on its own line.
Input: one integer n. Output: n lines: 1..n.
Your program reads from stdin and prints to stdout.
Example 1
Input: 3
Output: 1 2 3
Hints