# Find the Armstrong number using C language

If any number is equal to the sum of its own digits raised to the power of the digits size is called Armstrong Number. All single digits are armstrong Number because power of those numbers is 1. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.
armstrong.c
``````1 #include <stdio.h>
2
3 int calculate_power(int base,int exponent) {
4 	int sum = 1;
5 	while(exponent > 0) {
6 		sum = sum * base;
7 		exponent = exponent - 1;
8 	}
9 	return sum;
10 }
11
12 int main() {
13 	int number, temp, count = 0, total = 0;
14 	printf("Enter the integer number: ");
15 	scanf("%d", &number);
16
17 	temp = number;
18 	while(temp > 0) {
19 		count = count + 1;
20 		temp = temp/10;
21 	}
22
23 	temp = number;
24 	while(temp > 0) {
25 		total = total + calculate_power(temp%10,count);
26 		temp = temp/10;
27 	}
28
29 	if(number == total) {
30 		printf("%d is an Armstrong number.\n", number);
31 	}
32 	else
33 	{
34 		printf("%d is not an Armstrong number.\n", number);
35 	}
36 	return 0;
37 }``````