computing-fundamentals
C programs and question bank.
Wednesday, October 27, 2010
armstrong number-C
void main()
{
int n,b=0,a;
printf(“Enter the num”);
scanf(“%d”,&n);
a=n;
while(n>0)
{
r=n%10;
b=b+r*r*r;
n=n/10;
}
if(b==a)
{
printf(“it is a Armstrong num”);
}
else
{
printf(“is is Not an Armstrong num”);
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment