Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main(void)
- {
- int num, numLength, tmpNum, sum = 0, n;
- scanf("%d", &num);
- numLength = log10(num);
- tmpNum = num;
- for(int i = numLength; i >= 0; i--)
- {
- n = tmpNum / pow(10, i);
- sum += pow(n, numLength+1);
- tmpNum = tmpNum % (int)pow(10, i);
- }
- if(sum == num) printf("true\n");
- else printf("false\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement