Skip to content

Instantly share code, notes, and snippets.

@lazyakshay
Created April 8, 2017 13:10
Show Gist options
  • Save lazyakshay/8545500400634abe7b54e9de2375faae to your computer and use it in GitHub Desktop.
Save lazyakshay/8545500400634abe7b54e9de2375faae to your computer and use it in GitHub Desktop.
print the digit that are at odd position
#!/bin/bash
echo "enter 5 digit number"
read number
n=1
while((n<=5))
do
a=`echo $number | cut -c $n`
echo -n "$a"
n=`expr $n + 2`
done
echo " "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment