If a 3-digit number equals the cubic sum of its members, it is called the number of daffodils.
For example, so 407 is a number of daffodils, write a program to find out all the number of daffodils between 100~999.
1#include <stdio.h>2#include <stdlib.h>3 //to determine the number of daffodils, is to return 14 intIsnarcissus (intn);5 6 intMain ()7 {8 inti;9 for(i = -; I < +; i++)Ten if(Isnarcissus (i)) Oneprintf"%4d", i); Aprintf"\ n"); - -System"Pause"); the return 0; - } - //determines whether n is a daffodil number, or returns 1, otherwise returns 0 - intIsnarcissus (intN) + { - intsum =0;//Record cubes and + inttemp = n;//Staging this number A while(Temp >0) at { -sum = sum + (temp%Ten) * (temp%Ten) * (temp%Ten); -Temp/=Ten; - } - if(Sum = =N) - return 1; in Else - return 0; to}
Write a program to find out the number of daffodils between 100~999