Looping and Skipping HackerRank Solution

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

Looping and Skipping HackerRank Solution

Problem

Your task is to use for loops to display only odd natural numbers from 1 to 99.

Input Format

There is no input.

Constraints

Output Format

1
3
5
.
.
.
.
.
99

Sample Input

Sample Output

1
3
5
.
.
.
.
.
99

Explanation

Looping and Skipping HackerRank Solution

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

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

Leave a Comment