C Programming By Vijay Jadhav
Tuesday, 17 February 2015
Find given number is Armstrong Number or not
Armstrong Number
void main()
{
int n,b=0,t;
clrscr();
printf("Enter the no");
scanf("%d",&n);
t=n;
while(n>0)
{
a=n%10;
b=b+a*a*a;
n=n/10;
}
if(b==t)
{
printf("Armstrong no");
}
else
{
printf("Not an armstrong no");
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment