Armstrong Number

#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int no,temp;
cout<<"enter the no. you want to check";
cin>>no;
temp=no;
while(no)
{
d=no%10;
sum=sum+(d*d*d);
no=no/10;
}
if(sum==temp)
cout<<"Armstrong";
else
cout<<"Not Armstrong";
//coding by Jerry Johns.
//http://jerryjo94.blogspot.com
getch();
}

0 comments:

Post a Comment