Close
Topic list
Can You Print
EASY
12 mins
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Can You Print

Contributed by
Easy
0/40
Avg time to solve 12 mins
Success Rate 96 %
Share

## Problem Statement

#### You are given an integer ‘N’. You have to print integers from 1 to N.

##### For Example:
``````Input: 'N' = 6

Output: 1 2 3 4 5 6

If 'N' = 6, The numbers from 1 to 6 are 1, 2, 3, 4, 5, 6.
Hence, the output will be 1 2 3 4 5 6.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1 :
``````2
6
2
``````
##### Sample output 1 :
``````1 2 3 4 5 6
1 2
``````
##### Explanation For Sample Output 1 :
``````For the first test case:
N = 6
The numbers from 1 to 6 are 1, 2, 3, 4, 5, 6.
Hence, the output will be 1 2 3 4 5 6.

For the second test case:
N = 2
The numbers from 1 to 2 are 1, 2.
Hence, the output will be 1 2.
``````
##### Sample Input 2 :
``````2
3
4
``````
##### Sample output 2 :
``````1 2 3
1 2 3 4
``````
Auto
Console