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
Wednesday, January 14, 2009
Program in UNIX to find out whether it is an odd number or even number
Posted by ars at 6:45 AM
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment