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

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart