AIM:
To write a shell program for checking whether the given string is palindrome or not.
ALGORITHM:
· Get the given string.
· Reverse the string.
· Compare the given string with reversed string if they are equal print “palindrome” otherwise “not palindrome”.
PROGRAM SOURCE CODE
echo ”enter the string”
read a
r=$a
len=`expr length $a`
c=1
f=” “
while [ $c – le $len ]
do
e= `expr substr $a $c1 `
f=$e$f
c=`expr $c + 1`
done
echo “the reversed string is $f”
if [ $r=$f ]
then
echo “the given string is palindrome”
else
echo “the given string is not palindrome”
fi
CONCLUSION:
Thus the shell program to check palindrome or not are written and executed successfully.
Monday, May 17, 2010
LINUX SEHLL PROGRAM FOR PERFORMING PALINDROME CHECKING | WHETHER THE GIVEN STRING IS PALINDROME OR NOT | OPERATING SYSTEM (OS) LAB IN LINUX ENVIRONMENT
Subscribe to:
Post Comments (Atom)
Labels
3D-2D Translation
Algorithms
Batch Programming
C language
C world
C++
DBMS
Ebook
Games
JAVA
Java Programs
JNTU MATERIALS
JNTU PREVIOUS QUESTION PAPERS
JNTU SYLLABUS BOOKS
LAB MANUALS
Linux
Mobile softwares
Networking
Online Programs
PC TIPS
Software Diagrams
Software Engineering
Softwares
System Software
Visual Basic
0 comments:
Post a Comment