Search This Blog

Thursday, February 10, 2011

Programme to check that given number is armstrong or not

#include<stdio.h>
#include<conio.h>
void main()
{
int n,d,s=0,t;
clrscr();
printf("enter value");
scanf("%d",&n);
t=n;
while(n>0)
{
d=n%10;
s=s+d*d*d;
n=n/10;
}
if(t==s)
printf("%d is armstrong number",t);
else
printf("%d isnt armstrong number",t);
getch();
}

No comments:

Post a Comment