ArmStrong Number program using C

This “ArmStrong Number Program using C” post giving implemenation program to find the given input number is ArmStrong or Not using C language syntax.


#include<stdio.h>
void main()
{
int n, r, sum=0 , temp;
printf(“Enter one number : “);
scanf(“%d”, &n);

temp=n ;
while(n>0)
{
r=n%10;
sum=sum+r*r*r;
n=n/10;
}
n=temp;
if(n==sum)
printf(“Arm strong number \n”;
else
printf(“Not an Armstrong number \n”);
}

Share this