Write a script to print even and an odd number from any range.
Write a script in most simplest way,
Because the way I asked for the same question, it doesn't give me any result, either provide two different method or script
echo "enter n value as range to calculate odd and even numbers."
read n
i=1
while [ $i -le $n ]
do
if [ `expr $i % 2` -eq 0 ]
then
echo even=$i
else
echo odd=$i
fi
i=`expr $i + 1`
done
Comments
Leave a comment