mdnurnobihosen

Assignment10.1

Feb 24th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5.     int p=0,n,m,r,c,result=0;
  6.     printf("Input :");
  7.     scanf("%ld",&m);
  8.     m=n;
  9.     while(n!=0){
  10.         n/=10;
  11.         p++;
  12.     }
  13.     m=n;
  14.     while(n!=0){
  15.  
  16.         r=n%10;
  17.         c= pow(r,p);
  18.         result=result+c;
  19.  
  20.         n/=10;
  21.  
  22.     }
  23. printf("Output : ");
  24. if(result==m)
  25.     printf("Armstrong \n");
  26.   else printf("Not armstrong \n");
  27.  
  28.  
  29.  
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment