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: Raynard Fischer     Category: Unix / Linux / Ubuntu     Views: 4841

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: 



Raynard Fischer
Raynard Fischer author of Write a shell script to display the digits which are in odd position in a given 5 digit number is from Frankfurt, Germany.
 
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!