#B2142. Recursive Sum of Natural Numbers

    ID: 11224 Type: Default 1000ms 256MiB

Recursive Sum of Natural Numbers

Recursive Sum of Natural Numbers

Given a positive integer \(N\), compute the sum \(1 + 2 + 3 + \cdots + N\) using recursion.

You need to write a recursive function that returns the sum of the first \(N\) natural numbers.

inputFormat

The input consists of a single line containing a positive integer \(N\) (\(N \geq 1\)).

outputFormat

Output the sum of the first \(N\) natural numbers.

sample

1
1