Looping with Numbers HackerRank Solution

Hello coders, In this post, you will learn how to solve the Looping with Numbers HackerRank Solution. This problem is a part of the Linux Shell series.

Looping with Numbers HackerRank Solution

Problem

Use a for loop to display the natural numbers from 1 to 50.

Input Format

There is no input

Output Format

1
2
3
4
5
.
.
.
.
.
50

#!/bin/bash
for i in {1..50}
do
    echo $i
done

Note: This problem (Looping with Numbers) is generated by HackerRank but the solution is provided by chase2learn. This tutorial is only for Learning and Educational purpose.

Sharing Is Caring