Code In Tech - The Ultimate World of Computer Technology

Saturday, 12 May 2012

Shell script to find whether the given no. is odd or even


SOURCE CODE:

echo “Enter the no.:”
read a
e= `expr $a % 2`
if test $e –eq 0
then
echo “no. is EVEN”
else
echo “no. is ODD”
fi

OUTPUT:

Enter the no.: 
7
 no. is ODD

No comments :

Post a Comment