Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script para convertir un número a binario
#!/bin/bash
binario=" "
echo "Introduce cualquier número para convertirlo a binario"
read num
dividendo=$num
while [ $dividendo -gt 0 ]
do
let cociente=$dividendo/2
let resto=$dividendo%2
binario=$resto$binario
dividendo=$cociente
done
echo "El numero que has introducido corresponde en binario al $binario"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.