Wednesday, January 14, 2009

Program in UNIX to find out whether it is an odd number or even number

Any integer input through the keyboard. Write a program to find out whether it is an odd number or even number.

echo "Enter an integer"
read num

if [ `expr $num % 2` -eq 0 ]
then
echo "$num is even"
else
echo "$num is odd"
fi

Program in UNIX to find out whether it is an odd number or even numberSocialTwist Tell-a-Friend

0 comments: