Print Numbers 1 to N
Print Numbers 1 to N
EasyLoops58% accepted
Given a positive integer N, print all integers from 1 to N each on a new line. This is one of the very first loop exercises every programmer writes. It builds muscle memory for writing basic for/while loops.
Approach
Given N, print each integer from 1 to N on its own line.
Input
1
Output
1
More Loops problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards