Page

Code for ARMSTRONG NUMBER in c language

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

No comments:

Post a Comment