Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Armstrong Number in C

#include <stdio.h>
 
main()
{
   int no, res = 0, a, rem;
 
   printf("Enter a number\n");      
   scanf("%d",&no);
 
  a = no;
 
   while( a != 0 )
   {
      rem = a%10;
      res = res+ rem*rem*rem;
      ta = a/10; 
   }
 
   if ( no == res )
      printf("Entered number is an armstrong number.");
   else
      printf("Entered number is not an armstrong number.");         
 
   return 0;
}