# C Program To Determine If The Given 3 Digit Number Is An Armstrong Number

Updated on February 25, 2013

## Armstrong Number :

Armstrong number is the n digit number whose each digit is raised to power n and is added to other nth power digits giving total Sum equal to the n digit number. In other words, A 3 digit Armstrong number will be the one whose Sum of cube of 3 digits is exactly equal to the number.

Let us make it more clear by taking the example :

370 = 3^3 + 7^3 + 0^3 => 27 + 343 + 0 => 370

In the above example , since 370 is a 3 digit number , so we took the cube of each digit and added their result which ultimately gave us the number we started with. Hence 370 is an Armstrong number.

I have Provided the C Program Source Code to find the Armstrong number. You need to copy the source code in the notepad and save it with extension *.c . Then you can compile and run the program easily.

## C Program Source Code for 3 digits Armstrong number

```#include<stdio.h>
#include<conio.h>
int main()
{
int number,armstrng,m,n,o,p;
printf("Enter any 3 digit number: ");
scanf("%d",&number);
p=number;
m=number%10;
number=number/10;
n=number%10;
number=number/10;
o=number;
armstrng=(m*m*m)+(n*n*n)+(o*o*o);
if(armstrng==p)
printf("%d is an armstrong number.",p);
else
printf("Sorry!! %d is not an armstrong number.",p);
getch();
}
```

8

164

0

20

22

1

18