Sha256: c371891ec8bf1fefd4c4622feda48a081a0af7b58074551cf28c308e22477ccc

Contents?: true

Size: 271 Bytes

Versions: 6

Compression:

Stored size: 271 Bytes

Contents

#!/bin/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

6 entries across 6 versions & 1 rubygems

Version Path
trackler-2.2.1.82 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.81 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.80 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.79 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.78 tracks/bash/exercises/armstrong-numbers/example.sh
trackler-2.2.1.77 tracks/bash/exercises/armstrong-numbers/example.sh