Sum of N natural numbers
Submit solution
C
Points:
10 (partial)
Time limit:
8.0s
Memory limit:
64M
Authors:
Problem type
Allowed languages
Problem Statement
Given a positive integer N as input, print the sum of natural numbers up to N. When N is less than or equal to 0, 0 should be printed
Sample Input
5
Sample Output
15
Explanation
Sum of natural numbers from 1 to 5 is 15
Comments