PDA

View Full Version : codint problem



maruf10
January 9th, 2009, 05:10 PM
i want to print the even number ranging from 1 to 100
here is the code
i am unable to find the bug
please help
thanks in advance



for (( i=1 ; i<=100 ; i++ ))
do
a=`expr $i%2`
if test $a -eq 0
then
echo $i
fi
done

saulgoode
January 9th, 2009, 05:53 PM
Try putting spaces into your function: `expr $i % 2`