#include<stdio.h>
#include<conio.h>
int main()
{
long int s = 0,d,n,t;
printf ("ENTER ANY NUMBER :");
scanf ("%ld",&n);
t = n;
while (t)
{
d = t % 10;
s = s + d*d*d;
t /= 10;
}
if (s == n)
printf ("%d IS ARMSTRONG NUMBER ",n);
else
printf ("%d IS NOT ARMSTRONG NUMBER ",n);
return 0;
getch();
}
#include<conio.h>
int main()
{
long int s = 0,d,n,t;
printf ("ENTER ANY NUMBER :");
scanf ("%ld",&n);
t = n;
while (t)
{
d = t % 10;
s = s + d*d*d;
t /= 10;
}
if (s == n)
printf ("%d IS ARMSTRONG NUMBER ",n);
else
printf ("%d IS NOT ARMSTRONG NUMBER ",n);
return 0;
getch();
}
0 comments :
Post a Comment