Program to Check Armstrong Number - ( C Programs )
Heading
This is a C program to determine if a number is an Armstrong number.
Example
Enter a number to check if it's an Armstrong number: 153
Output
Output: 153 is an Armstrong number.
Explanation
An Armstrong number is a number whose cube of its digits is equal to the number itself. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153.
This program first takes the input number and then calculates the sum of its cubes. This sum is then compared to the original number and if the two are equal, the number is an Armstrong number.
Use
This program can be used to check if a given number is an Armstrong number. It can also be used for educational purposes to illustrate the concept of Armstrong numbers in programming.
Summary
In summary, this C program takes a number as input and checks if it's an Armstrong number by calculating the sum of its digits raised to the power of the number of digits and comparing it to the original number. If the two are equal, the number is an Armstrong number.