diff options
Diffstat (limited to 'test/aarch64/c/armstrong.c')
-rw-r--r-- | test/aarch64/c/armstrong.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/aarch64/c/armstrong.c b/test/aarch64/c/armstrong.c new file mode 100644 index 00000000..c5d838f9 --- /dev/null +++ b/test/aarch64/c/armstrong.c @@ -0,0 +1,21 @@ +int main() +{ + int n,sum,i,t,a,z; + + for(i = 1; i <= 500; i++) + { + t = i; // as we need to retain the original number + sum = 0; + while(t != 0) + { + a = t%10; + sum += a*a*a; + t = t/10; + } + + if(sum == i) + z += i; + } + + return 0; +} |