shell4.sh 161 B

1234567891011
  1. #!/bin/bash
  2. echo "Enter a number"
  3. read no
  4. while [ $no -gt 0 ]
  5. do
  6. add=`expr $no % 10`
  7. sum=`expr $sum + $add`
  8. no=`expr $no / 10`
  9. done
  10. echo "sum of theno is "$sum