C program For Armstrong number in limit between 1 to 1000
#include
#include
void main()
{
int n,a,m,i;
clrscr();
for(i=1;i<=10000;i++)
{
//printf("enter a no");
//scanf("%d",&n);
int sum=0;
a=i;
while(a!=0)
{
m=a%10;
a=a/10;
sum=sum+(m*m*m);
}
if(sum==i)
{
printf("%d\t ",i);
}
#include
void main()
{
int n,a,m,i;
clrscr();
for(i=1;i<=10000;i++)
{
//printf("enter a no");
//scanf("%d",&n);
int sum=0;
a=i;
while(a!=0)
{
m=a%10;
a=a/10;
sum=sum+(m*m*m);
}
if(sum==i)
{
printf("%d\t ",i);
}
No comments
Post a Comment