Shell script to check a given number is palindrome or not, Programming Languages

 W.A.S.S to check whether a given number is palindrome or not.

 

Program

 

   # W.A.S.S to check whether a given number is palindrome or not.

 

echo "Enter any no.:"

read num

temp=$num

rem=0

len=0

result=0

 

while test $temp -gt 0            # loop to find the revese of the given number

do

rem=`expr $temp % 10`

result=`expr $result \* 10 + $rem`

temp=`expr $temp / 10`

done

echo "$result "

 

if test $result = $num             #if reverse of no is same as given no  

then

echo "Entered no is palimdrom"

else

echo "Entered is not a palimdrom"

fi

 

Output

 

Enter any no.:

1221

1221

Entered no is palimdrome

 

Enter any no.:

1234

4321

Entered is not a palimdrome

Posted Date: 9/26/2012 4:47:02 AM | Location : United States







Related Discussions:- Shell script to check a given number is palindrome or not, Assignment Help, Ask Question on Shell script to check a given number is palindrome or not, Get Answer, Expert's Help, Shell script to check a given number is palindrome or not Discussions

Write discussion on Shell script to check a given number is palindrome or not
Your posts are moderated
Related Questions
Selfcare Project:   Technology Used Strut Frame work, WAS 5.1, WPS 6.0, DB2, AJAX, Eclipse, Rational Application Developer 6 and  DB2 Selfcare is a big umbrella under whic

.NET Windows Services But Enthusiasm has an amazing record of beginning overdue but finding up easily. This is real in situation of .NET too. Enthusiasm put their best men at

Example- Arithmetic :  Given the subsequent two matrices, So calculate A-5B. Solution There isn't much to do now other than the work. We first multiplied

Im having problems with my php / mysql code. I am trying to make it so it looks for an asset Number and if it is in the shop if the asset is in the database but is not in the shop

Simpson's Rule is a more accurate method of numerical integration than the method described in class. Using Simpson's Rule, the integral of a function f between a and b is approxim

In combat simulation software, exploding land mines cause damage to military vehicles. In addition to the damage done to the vehicles themselves, we are interested in the number of

Pascal program: Exactly what you need to do to generate your empirical data is specific to your individual assignment. However, some rules apply to all of you: 1. The gener


In this Project your task is to create a program that displays various levels of the fractal structure of the so called square shaped Sierpinski-carpet. The display of level 4 is s