Loading
View RSS Feed

sachdev

Shell Script To Determine Positive as well as Odd or Even Number

Rating: 2 votes, 5.00 average.
Code:
echo "Enter The Number:"
read a
if [ $a -eq 0 ] ; then
echo "Number Is Zero"
elif [ $a -lt 0 ] ; then
echo "The Number Is Negetive"
else
echo "the No Is Positive"
fi
e=2
c=`expr $a % $e`
if [ $c -eq 0 ] ; then
echo "The No is Even"
else
echo "the no is odd”
fi
output

Code:
[cs08130001045@FileServer ~]$ sh oddeven
Enter The Number:
45
the No Is Positive
the no is odd

Submit "Shell Script To Determine Positive as well as Odd or Even Number" to Digg Submit "Shell Script To Determine Positive as well as Odd or Even Number" to del.icio.us Submit "Shell Script To Determine Positive as well as Odd or Even Number" to StumbleUpon Submit "Shell Script To Determine Positive as well as Odd or Even Number" to Google

Updated 12-04-2011 at 07:01 PM by Harsh

Categories
Unix

Comments




Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.