Armstrong number
//Armstrong Number
#include<stdio.h>
#include<conio.h>
void main()
{int n,dupe,sum=0,x;
clrscr();
printf("enter the number");
scanf(" %d",&n);
dupe=n;
while(dupe!=0)
{x=dupe%10;
sum=sum+x*x*x;
dupe=dupe/10;
}
if(sum==n)
printf("\n armstrong no");
else
printf("\n not arm.no");
getch();
}
No comments:
Post a Comment