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

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
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***