diff --git a/armstrong.c b/armstrong.c new file mode 100644 index 0000000..53c9879 --- /dev/null +++ b/armstrong.c @@ -0,0 +1,28 @@ +#include +#include +void main() +{ + int num,n,count=0,res=0; + printf("Enter an integer :: "); + scanf("%d",&num); + n=num; + while(n!=0) + { + n=n/10; + count++; + } + n=num; + while(n!=0) + { + res=res+pow(n%10,count); + n=n/10; + } + if(num==res) + { + printf("The given integer is armstrong\n"); + } + else + { + printf("The given integer is not armstrong\n"); + } +}