echo -n "What is your name ? "
read name
echo "Hi $name"
echo -n "Enter a number: "
read num
echo -n "Even numbers below $num: "
for((i = 1; i <= $num; i++))
do
if [ `expr $i % 2` == 0 ]
then
echo -n "$i ";
fi
done
echo -e ""
echo -n "Odd numbers below $num: "
j=1
while [ $j -le $num ]
do
if [ `expr $j % 2` != 0 ]
then
echo -n "$j "
fi
j=`expr $j + 1`
done
echo -e ""
read name
echo "Hi $name"
echo -n "Enter a number: "
read num
echo -n "Even numbers below $num: "
for((i = 1; i <= $num; i++))
do
if [ `expr $i % 2` == 0 ]
then
echo -n "$i ";
fi
done
echo -e ""
echo -n "Odd numbers below $num: "
j=1
while [ $j -le $num ]
do
if [ `expr $j % 2` != 0 ]
then
echo -n "$j "
fi
j=`expr $j + 1`
done
echo -e ""
No comments:
Post a Comment