Skip to content

Instantly share code, notes, and snippets.

@dflima
Last active August 24, 2016 13:01
Show Gist options
  • Save dflima/f9c95bd25b0e6e1c989b7a357b937d22 to your computer and use it in GitHub Desktop.
Save dflima/f9c95bd25b0e6e1c989b7a357b937d22 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Enter number to be converted: "
read no
echo "Converting $no from decimal to binary (base2)"
no=`echo "obase=2;$no" | bc`
echo Binary: $no
echo "Converting binary($no) to decimal"
no=`echo "obase=10;ibase=2;$no" | bc`
echo Number in decimal: $no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment