Skip to main content
Haui's Bytes
  • Source
  • Archive
  • Tags
  • RSS feed
  • Disclaimer

Calculate the sum of digits of a given number

Haui

2008-08-11 12:00

Source

echo 1234 | sed 's/\(.\)/\1\+/g' | sed 's/.$//' | bc -l
perl -e 'print eval join "+", split //, 12345;'
  • linux
  • Previous post
  • Next post
Contents © 2019 Haui - Powered by Nikola