Paste Search Dynamic
Recent pastes
range of number
  1. echo "Input starting range of number : "  
  2.  read sn
  3.  echo "Input ending range of number: "  
  4.  read en
  5. echo "nnThe Strong numbers are :n"
  6. for ((k=sn;k<= en;k++))
  7.    do
  8.      n=$k
  9.      
  10.  
  11. sum=0
  12. k=$n
  13. while [ $n -gt 0 ]
  14. do
  15. d=`echo $n%10|bc`
  16. fact=1
  17. i=1
  18. while [ $i -le $d ]
  19. do
  20. fact=`echo $fact*$i|bc`
  21. i=`echo $i+1|bc`
  22. done
  23. sum=`echo $sum+$fact|bc`
  24. n=`echo $n/10|bc`
  25. done
  26. if [ $sum -eq $k ]
  27. then
  28. echo "$k"it is strong number
  29. else
  30. echo "$k"it is not strong number
  31. fi
  32.    
  33. done
Parsed in 0.012 seconds