check whether the number is armstrong number or not
// add digits of the number using recurssion
#include<stdio.h>
int main(){
int i,j,k,n,b=0;
printf("enter the number which you want to check that wheter the number is armstrong or not:");
scanf("%d",&n);
j=n;
while(n>0)
{
i=n%10;
b=b+i*i*i;
n=n/10;
}
if(b==j)
{
printf("it is the armstrong number:");
}
else
printf("it is not the armstrong number:");
}
Comments
Post a Comment