diff --git a/isArmstrong.C b/isArmstrong.C new file mode 100644 index 00000000..75b64f39 --- /dev/null +++ b/isArmstrong.C @@ -0,0 +1,24 @@ +#include + +int main() +{ + int n, sum=0, i, num; + printf("Enter number: "); + scanf("%d",&n); + num=n; + while (n!=0) + { + i=n%10; + sum=sum+(i*i*i); + n=n/10; + } + if (sum==num) + { + printf("%d is an armstrong number!", num); + } + else + { + printf("%d is not an armstrong number!", num); + } + return 0; +} \ No newline at end of file