Find the sum of all odd numbers from 1 to n.
- Input will be the limit
n.
- Return the sum of all the odd numbers from
1 to n.
n should NOT be included in the sum.
- Do NOT use
do..while or any other looping constructs.
Use higher-order functions like map, filter, etc.
For example: