Looping with Numbers – HackerRank Solution

In this post, we will solve Looping with Numbers HackerRank Solution. This problem (Looping with Numbers) is a part of Linux Shell series.

Contents

Task

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

Solution – Looping with Numbers – HackerRank Solution

#!/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 CodingBroz. This tutorial is only for Learning and Educational purpose.

Leave a Comment

Your email address will not be published.