006-001-008

For Loop: Print 1 to 5

Easy

Problem Description

for loop: Print 1 to N

In this problem, you will create a program that reads an integer N from standard input, then uses a for loop to iterate from 1 to N and displays each integer on a separate line to standard output.

Learning Objective: Understand basic for loop syntax and implement iteration based on an input value

Overview

Read an integer N from standard input and create a program that prints numbers from 1 to N using a for loop.

Specifications

  • Read an integer N (N >= 1) from standard input
  • Use a for loop for repetition
  • Output integers from 1 to N, one per line

Input Format

N

Output Format

1
2
...
N

Sample Input/Output

Input:

5

Output:

1
2
3
4
5

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up