Armstrong Number in C

Armstrong Number in C Language

Before writing a program in C language to check whether the number is Armstrong or not, First we will understand what is Armstrong number.

What is the Armstrong Number

Armstrong number is a number that is equal to the sum of cubes of its digits. For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers.

Note: there are six Armstrong numbers in the range of 0 and 999.

Armstrong number 1: 0
Armstrong number 2: 1
Armstrong number 3: 153
Armstrong number 4: 370
Armstrong number 5: 371
Armstrong number 6: 407


Let's try to understand why 153 is an Armstrong number.



Let's try to understand why 371 is an Armstrong number.

Let's see the c program to check any number provided by user is Armstrong Number or not

Output:
enter the number=153
armstrong number
enter the number=5
not armstrong number


EmoticonEmoticon