We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Three solutions; the last one is the " real" solution since it is checking for odd numbers according to the problem instructions.
# Solution (1)#for n in {1..99..2} # start at 1, count up to 99 by incrementing by 2#do# echo $n#done# # Solution (2) # same here#for (( n = 1; n <= 99; n += 2 ))#do# echo $n#done## Solution (3) # by checking for odd numbersfornin{1..99}doif(($n%2!=0))thenecho$nfidone
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Looping and Skipping
You are viewing a single comment's thread. Return to all comments →
Three solutions; the last one is the " real" solution since it is checking for odd numbers according to the problem instructions.