Write a shell script to find out whether the number entered is odd or even?
echo "Enter a
no.: "
read n
x=`expr $n % 2`
if [ $x -eq 0 ]
then
echo "EVEN"
else
echo "ODD"
fi
OUTPUT :
Enter a no.:
2
EVEN
Enter a no.:
1
ODD
Comments
Post a Comment