#include<stdio.h>
      #include<math.h>
      int main()
      {
          printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
          int n, sum = 0, c, t, a;
          printf("Enter a number:  ");
          scanf("%d", &n);
          t = n;  // as need to retain the original number
          while(n != 0)
          {
              a = n%10;
              sum += a*a*a;
              n = n/10;
          }
          printf("\n\n\n\t\t\tsum = %d", sum);
          if(sum == t)
              printf("\n\n\t\t%d is an armstrong number\n", t);
          else
              printf("\n\n\t\t%d is not an armstrong number\n", t);
          printf("\n\n\n\n\t\t\tCoding is Fun !\n\n\n");
          return 0;
      }
      
      C language logo

      Program

      0

      0

      avatar
      natalie19970

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.