Program to Check number is Armstrong

/* A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 33 + 73 + 13 = 371. Some other armstrong numbers are: 0, 1, 153, 370, 407 */

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

   int n,digit, n1,sum=0;

   clrscr();

   printf(“Enter the Any Integer No: “);

   scanf(“%d”,&n);

   n1=n;

   while(n!=0)

   {

      digit = n%10;

      sum=sum+pow(digit,3);

      n/=10;

   }

   if (sum==n1)

      printf(“%d number is Armstrong “,n1);

   else

      printf(“%d number is Not Armstrong “,n1);

   getch();

}

Mohit Arora
Follow me