Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -ne 1 ]
- then
- echo "Ce programme n'accepte qu'un et un seul argument"
- exit 1
- else
- u=$1
- while [ $u -ne 1 ]
- do
- if [ $((u%2)) -eq 0 ]
- then
- u=$((u/2))
- echo $u
- else
- u=$((3*u+1))
- echo $u
- fi
- done
- fi
Add Comment
Please, Sign In to add comment