C program to display Armstrong number series upto N number.
/****************************************************
C program to display Armstrong number series upto N number.
*******************************************************/
#include<stdio.h>
#include<conio.h>
void main()
{
int i, rem,temp,armstrong, n;
printf("Up to which number you want Armstrong number series\n");
scanf("%d",&n);
printf("Series of Armstrong numbers up to %d\n",n);
for(i=1;i<=n;i++)
{
temp=i;
armstrong=0;
while(temp!=0)
{
rem=temp%10;
temp=temp/10;
armstrong=armstrong+(rem*rem*rem);
}
if(armstrong==i)
printf("%d\t",i);
}
printf("\nEnd of program");
}
Up to which number you want Armstrong number series
10000
Series of Armstrong numbers up to 1000
1 153 370 371 407
End of program
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏