#!/bin/ksh
############################
# This program accepts a string a prints the reverse of it without using any inbuilt function.
############################
#Print the input string
echo $1;
STRINGLEN=`echo $1 | wc -c`
for i in `seq 0 $LEN`
do
INDEX=$(( $STRINGLEN - ($i + 1) ))
C=`echo $1 | cut -c $INDEX`
echo $C
done
No comments:
Post a Comment