Write a program to check whether a given number is even or odd.

clear
echo "Enter the number to find whether even or odd"
read a
if [ `expr $a % 2` -eq 0 ]
then
echo "The number $a is even"
else
echo "the number $a is odd"
fi


Output
Enter the number to find whether even or odd
13
the  number 13 is odd

Enter the number to find whether even or odd14
the number 14 is Even

1 comment:

  1. We are urgently in need of KlDNEY donors for the sum of $500,000.00 USD, Email for more details:
    hospitalcarecenter@gmail.com
    WhatsApp +91 779-583-3215

    ReplyDelete