C Program to Generate Armstrong Number
This C Program Generates Armstrong Number within the Given Lower and Upper Limit
Input: Upper Limit and Lower Limit
Output: Generated Armstrong Numbers within the limit
#include<stdio.h>
main()
{
int i,sum,d1,d2,d3,ll,ul;
int a,b,c;
printf("Enter Lower Limit and Upper Limit-(**3DIGIT NUMBERS ONLY**) n");
scanf("%d%d",&ll,&ul);
i=ll;
for(;i<=ul;i++)
{
d1=i/100;
d2=(i/10)%10;
d3=i%10;
a=d1*d1*d1;
b=d2*d2*d2;
c=d3*d3*d3;
sum=a+b+c;
if(sum==i)
{
printf("%d n",i);
}
}
}
OUTPUT:
Enter Lower Limit and Upper Limit-(**3DIGIT NUMBERS ONLY**)
100 999
153
370
371
407
Recent Comments