Praveen | Typing Speed Test is a very useful Software available for free Download.

C Programs to Check Armstrong Number

      This C program to check the number is Armstrong number or Not. Armstrong number means this number is equal to sum of cubes of individual digits of a those number. For example:- 153=13 + 53 + 33.


C program code

#include<stdio.h>
#include<conio.h>

void main()
{
   int n, sum = 0, a, r;
   clrscr();
   printf("\n Enter a number ");     
   scanf("%d",&n);
   a = n;
   while( a != 0 )
   {
      r = a%10;
      sum = sum + r*r*r;
      a = a/10;
   }
   if ( n == sum )
      printf("\n %d number is an Armstrong number.",n);
   else
      printf("\n %d number is not an Armstrong number.",n);
  getch();
  }


Output:-