Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Write a shell script to display the digits which are in odd position in a given 5 digit number

Posted By: Luiz Silva     Category: Unix / Linux / Ubuntu     Views: 8557

Write a shell script to display the digits which are in odd position in a given 5 digit number.

Code for Write a shell script to display the digits which are in odd position in a given 5 digit number in Unix / Linux / Ubuntu

echo Enter a 5 digit number
read num
n=1
while [ $n -le 5 ]
do
a=`echo $num | cut -c $n`
echo $a 
n=`expr $n + 2`
done
  
Share: 



Luiz   Silva
Luiz Silva author of Write a shell script to display the digits which are in odd position in a given 5 digit number is from Salvador, Brazil.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
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!