Program to Check Whether a Number is Armstrong Number or not
#include<stdio.h>
//declaration of function
int arm(int);
void main()
{
int a,b;
printf("enter the number: ");
scanf("%d",&a);
b = arm(a);
if(b==a)
printf("the entered number is armstrong");
else
printf("the given number is not armstrong");
}
//definition of function to check a number for Armstrong Number
int arm(int x)
{
int b = 0,a = 0;
while(x>0)
{
a = x%10;
b +=a*a*a;
x = x/10;
}
return b;
}
If You Liked This Post Please Take a Time To Share This Post
This comment has been removed by the author.
ReplyDeleteArmstrong program in C
ReplyDeletenice ji
Very informative article.Thank you author for posting this kind of article .
ReplyDeletehttp://www.wikitechy.com/view-article/c-program-to-check-armstrong-number-with-example-and-explanation
Both are really good,
Cheers,
Venkat