Saturday, July 13, 2019

Armstrong Numbers

Armstrong Numbers

armstrong number



#include<stdio.h>
#include<conio.h>

void main()
{
int no,sum=0,temp,remainder;
clrscr();
printf("Enter The Number :- ");
scanf("%d",&no);

temp=no;

while(no>0)
{
remainder=no%10;
sum=sum+(remainder*remainder*remainder);
no=no/10;
}
if(temp==sum)
{
printf("Armstrong number ");
}
else
{
printf("Not Armstrong number ");
}

getch();
}


Output:




EmoticonEmoticon