The armstrong number is of the form 153= 1^{3} + 5^{3} + 3^{3}

The input is : 153 or any other number

output: The number is armstrong or not.

Processing: take 153 as an example, remove 3, 5 and 1 in the reverse order (using % operator) and take the power of 3 and add to the sum variable.

if the total sum and the original number, both are same, then that is the arm strong number.

if else, the number is not an armstrong number

**#include <stdio.h> **

#include <conio.h>

**int main() **

{

int original_num, check, temp, sum=0;

printf("Enter the number to check for armstrong number");

scanf("%d", &original_num); // Get the original number

** temp=original_num; **

while(original_num>0) //run the loop till the number becomes 0

** { **

check=original_num%10; //remove the last digit using modulo operator

** sum=sum+check*check*check; **//the last digit is taken power to 3 and added to sum

** original_num=original_num/10; **//truncate the last digit and run the loop again

** } **

if(sum==temp)

printf("This is an armstrong numbern");

else

printf("This is not an armstrong number n");

getch();

return 0;

}

### Like this:

Like Loading...

*Related*

Arun Praveen.RThank you,sir for publishing these programs on your website

shubhamThank u for the all yhe programs which u has attached to ur blog..

karthii cant understand wat is tis

AparnaThankyou sir.I WAS FULLY SATISFIED WITH THIS BLOG.:))

shruti m bhanuTHANKYOU SIR