Sha256: 7ecb72df71c44796ef2776735bcaa18106547e6f19dc3a936c0537a296508d6f

Contents?: true

Size: 279 Bytes

Versions: 3

Compression:

Stored size: 279 Bytes

Contents

#!/usr/bin/env bash

isarmstrong() {
  sum=0
  item=$1
  while [ $item -ne 0 ]
  do
    rem=`expr $item % 10`
    cube=`expr $rem \* $rem \* $rem`
    sum=`expr $sum + $cube`
    item=`expr $item / 10`
  done
  if [ $sum -eq $num ]
  then
    return 0
  else
    return 1
  fi
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trackler-2.2.1.85 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.84 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.83 tracks/bash/exercises/armstrong-numbers/example.sh