Pseudocode Compiler
Practice

Sum 1 to N

EASYLoops

Read a positive integer N. Output the sum of all integers from 1 to N (inclusive).

Input: A positive integer N. Output: The sum 1 + 2 + 3 + … + N.

Example:

Input:  5
Output: 15
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Sum 1–5
Inputs: 5
Expected: 15
Test 2: Sum 1–10
Inputs: 10
Expected: 55
Test 3: N = 1
Inputs: 1
Expected: 1
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade