write a c program to check weither given is Armstrong or not
Answers
Answered by
1
#include
#include
Void main()
{
Int n, s=0, r=0, c;
printf (“Enter an integer: “);
scanf(“%d”,&n);
c=n;
do
{
r=n%10;
s=(r*r*r) + s;
n=n/10;
}while(n>0);
/*checking numbers
if(s==c)
{
printf(“%d is an Armstrong Number”,n);
}
else
{
printf(“%d is not an Armstrong
Number.”,n);
}
return 0;
}
#include
Void main()
{
Int n, s=0, r=0, c;
printf (“Enter an integer: “);
scanf(“%d”,&n);
c=n;
do
{
r=n%10;
s=(r*r*r) + s;
n=n/10;
}while(n>0);
/*checking numbers
if(s==c)
{
printf(“%d is an Armstrong Number”,n);
}
else
{
printf(“%d is not an Armstrong
Number.”,n);
}
return 0;
}
satish2911:
Welcome
Similar questions