#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,n,a=0,b=0,sum=0;
printf("enter the limit of amstrong number: ");
scanf("%d",n);
for(i=1;i<=n;i++)
{
a=i;
while(a>0)
{
b=n%10;
sum=sum+ b*b*b;
a=a/10;
}
if(sum==i)
{
printf("%d",sum);
}
}
return 0;
}
it prints no errors but doest not work properly
rithish 13 Junior Poster in Training
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
rithish 13 Junior Poster in Training
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
rithish 13 Junior Poster in Training
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
rithish 13 Junior Poster in Training
poornamoksha 0 Newbie Poster
Gonbe 32 Newbie Poster
WaltP commented: Then why did you bather doing his moework for him in the first place? -3
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.