Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Sum Of First N Natural Numbers

Difficulty: Easy

Acceptance: 60.00%

Points: 20.00

You are given a positive integer n. Your task is to find and print the sum of the first n natural numbers, that is, add all numbers starting from 1 up to n and return the final sum.

The result should be displayed as a single integer. 

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 1 < n < 106
  • n is a positive integer.
Companies:
Microsoft Samsung Walmart
Topics:
Recursion
Locked Content
Access Restricted: Please Login to access the code editor and test cases.