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

Assignment Help:

 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


Related Discussions:- Shell script to check a given number is palindrome or not

Series solutions - higher order differential equations, The idea of this se...

The idea of this section is not to do anything new along with a series solution problem.  Instead this is here to exemplify that moving in a higher order differential equation does

Oracle, What is "No_Data_Found" in Oracle?

What is "No_Data_Found" in Oracle?

Write script to clear the variables in the workspace, Write a script called...

Write a script called 'prob2.m' that asks the user if they wish to clear the variables in the workspace. If the user responds with the strings 'y' or 'yes' then the workspace shoul

Define the if - else statement - computer programming, Define the If - else...

Define the If - else statement - computer programming? The If - else statement The universal form of if - else statement is                         if(expression)

Selfcare project - strut frame work, Selfcare Project:   Technology U...

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

Java string handling, Expertsmind brings you unique solution in java assig...

Expertsmind brings you unique solution in java assignments String Handling Series signifies a sequence of character types. It has set duration of personality sequence. Onc

Compare 2 strings, Normal 0 false false false EN-US X...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Asp.net and asp.net ajax, ASP.NET and ASP.NET AJAX ASP.NET AJAX, formerly k...

ASP.NET and ASP.NET AJAX ASP.NET AJAX, formerly known as "Atlas", is an Enthusiasm rendering of an AJAX centered structure, designed for ASP.NET (although it can be used on other s

Amen, Write a program that inputs two positive integers of, at most, 20 dig...

Write a program that inputs two positive integers of, at most, 20 digits and outputs the sum of the numbers. If the sum of the numbers has more than 20 digits, output the sum with

Design and implement instantiable classes, Overview Goals: The goals for...

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd