Problem èKnow that the inputted number is an armstrong number or not.

Rem è armstrong numbers are those numbers whose cube of digits is equal to the number itself

 

Answer è    

/*wap to know tha t the INPUTTED number is an armstrong number or not*/

/*armstrong numbers is that one whose sum of every digit's cube = number itself*/

#include <stdio.h>

main( )

{

int num2,nn,num,c,x,div,div1,sub;

div=nn=sub=0;

clrscr( );

printf ("\nenter the number---");

scanf ("%d", &num);

num2=num;

while (num>0)

{

div = num/10;

sub = num -(div * 10);

nn=nn+(sub*sub*sub);

num = div;

}

if (num2= =nn)

printf ("\n%d is an armstrong number", num2);

else

printf ("\n%d is not an armstrong number", num2);

getch ( );

return 0;

}