Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell script to reverse a number supplied by a user.

Posted By: Sarah Campbell     Category: Unix / Linux / Ubuntu     Views: 6929

Write a shell script to reverse a number supplied by a user.

Code for Write a shell script to reverse a number supplied by a user. in Unix / Linux / Ubuntu

echo -n "Input no : "
read no

length=`expr length $no`

while [ $length -ne 0 ]
do
    b=$b`expr substr $no $length 1`
    length=`expr $length - 1`
done
echo "Reverse no is " $b 
  
Share: 



Sarah Campbell
Sarah Campbell author of Write a shell script to reverse a number supplied by a user. is from Toronto, Canada.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!