Powered by Blogger.

Write a shell script to find whether a given number is even or odd.





echo "Enter a number: "
read num

if [ `expr $num % 2` -eq 0 ]
then
echo "$num is Even."
else
echo "$num is Odd."
fi
-------------------------------------------------------------------------------------------------

->OUTPUT:
---------

Enter a number:
8
8 is Even.

*************************************************************************************************
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment