Social Icons

Wednesday, 1 May 2013

Cheking Number is Palindrome


#!/bin/sh

echo -n "Enter any no to find Reverse :  "
read  n
p=$n
rev=0
while [ $n -gt 0 ]
do
z=$(($n%10))
n=$(($n/10))
rev=$(($(($rev*10)) + z))
done
echo " .............reverse of the no. is : ........   : $rev"

if [ $rev -eq $p ]
then
echo "............Number is Palindrome.......... "
else
 echo  "........Number  is Not Palindrome ............."
fi
exit 0
output : 

No comments:

Post a Comment

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management