Sunday 21 January 2018

Program for armstrong


#include<stdio.h>
#include<conio.h>
main()
{
int n,r,sum=0,t;
clrscr();
printf("enter the value:");
scanf("%d",&n);
t=n;
while(n!=0)
{
r=n%10;
sum=sum+r*r*r;
n=n/10;
}
if(t==sum)
{
printf("it is a armstrong");
}
else
{
printf("it is not armstrong");
}
getch();
}�

0 comments:

Post a Comment