Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- int t,i,N,orgN,digit,n;
- scanf("%d",&t);
- for(i=1;i<=t;i++)
- {
- scanf("%d",&N);
- n=0;
- orgN=N;
- while(N>0)
- {
- N/=10;
- n++;
- }
- N=orgN;
- while(N>0)
- {
- digit=N%10;
- N/=10;
- orgN=orgN-pow(digit,n);
- }
- if(orgN==0) printf("Armstrong\n");
- else printf("Not Armstrong\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement