/*------------------------------------------------ ---------------
Output all "daffodil numbers". A "daffodil number" is a 3-digit number in which the sum of the cubes of the digits is equal to the number itself.
For example: 153 is a "daffodil number" because 153=1*1*1+5*5*5+3*3*3.
-------------------------------------------------- -------------*/
#include <stdio.h>
void main()
{ int i,j,k,n; printf("The numbers of all daffodils are:\n"); for(n=100;n<=999;n++) { i=n/100; j=n/10%10; k=n%10; if(n == i*i*i + j*j*j + k*k*k) printf("%d\n ",n); } printf("\n"); }