HACKERANK SOLUTIONS, LINUX SCRIPTING
Your task is to use for loops to display only odd natural numbers from to.
Input Format
There is no input.
Constraints
-
Output Format
1
3
5
.
.
.
.
.
99
Sample Input
-
Sample Output
1
3
5
.
.
.
.
.
99 SOLUTION
-ne : Not Equal
code:
for((i=0;i<100;i++))
do
x=$((i%2))
if [ $x -ne 0 ]
then
echo "$i"
fi
done
No comments:
Post a Comment