Code:
echo -n "Enter the number : "
read n
let rem=n%2
if test $rem -eq 0
then
echo "$n is a even number ."
else
echo "$n is a odd number ."
fi
Output:
[ty2011330@localhost ~]$ sh j11.sh
Enter the number : 7
7 is a odd number .
[ty2011330@localhost ~]$ sh j11.sh
Enter the number : 10
10 is a even number .
No comments:
Post a Comment