Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Write a shell program to display the alternate digits in a given 7 digit number starting from the first digit

Posted By: Adelita Fischer     Category: Unix / Linux / Ubuntu     Views: 3626

Write a shell program to display the alternate digits in a given 7 digit number starting from the first digit.

Code for Write a shell program to display the alternate digits in a given 7 digit number starting from the first digit in Unix / Linux / Ubuntu

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



Adelita Fischer
Adelita Fischer author of Write a shell program to display the alternate digits in a given 7 digit number starting from the first digit is from Frankfurt, Germany.
 
View All Articles

 
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!