Looping and Skipping HackerRank Solution

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

Looping and Skipping HackerRank Solution
Looping and Skipping HackerRank Solutions

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

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 Solutions

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

Next: A Personalized Echo HackerRank Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad