#include<stdio.h> #include<stdlib.h> void main() { int rem=0,rev,a,n,i; printf("Enter a end number ") ; scanf (" %d", &a) ; for(i=1; i<=a; i++) { rev=0; n=i; while(n! =0) { rem=n%10; rev=rev+rem*rem*rem; n=n/10; } if(i==rev) { printf("%d is a amstrong number ", i) ; } } } |
Enter a end number : 1000 1 is a amstrong number 153 is a amstrong number 370 is a amstrong number 371 is a amstrong number 407 is a amstrong number