Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n,r, remainder, result = 0;
- printf("Enter a three digit integer: ");
- scanf("%d", &n);
- r=n;
- while (r!= 0)
- {
- remainder = r%10;
- result += remainder*remainder*remainder;
- r /= 10;
- }
- if(result == n)
- printf("%d is an Armstrong number.",n);
- else
- printf("%d is not an Armstrong number.",n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement