// Sum of the cube of all digits of a number is equal to the number , itself.
// 153 = 1*1*1+5*5*5+3*3*3
#include <iostream.h>
#include <conio.h>
void main()
{
int a, dig , sum = 0;
cout<<"\n Enter A No.:";
cin>>a;
for(int i = a; i>0 ; i = i/10)
{
dig = i%10;
sum = sum + dig*dig*dig;
}
if(sum == a)
cout<<"\n The no. is Armstrong No.";
else
cout<<"\n The no. is not a Armstrong No.";
getch();
}
No comments:
Post a Comment