#include<stdio.h>
#include<stdlib.h>
void main()
{
int sum=0, i, a, rem=0,rev=0;
printf("Enter a number ") ; scanf (" %d", &a) ; sum=a; while(sum! =0) { rem=sum%10; rev=rev+rem*rem*rem; sum=sum/10; } if(a==rev) { printf ("%d is a amstrong number ", a) ; } else { printf(" %d is not a amstrong number ", a) ; } } |
Enter a number : 153 153 is a amstrong number