#include <stdio.h>int main () {int num,unit,ten,hundred; int i=0; printf ("Daffodil number: \ n"); for (num=100;num<=999;num+ +) {hundred=num/100; ten= (num-hundred*100)/10; unit=num-hundred*100-ten*10; if (num==hundred*hundred*hundred+ten*ten*ten+unit*unit*unit) {printf ("%d \ n", num); i=i++; }} printf ("i=%d", I); return 0;}
Find out all the "daffodils" between 0~999 and output:
"Narcissus number" means a three-digit number whose numbers are cubic and exactly equal to that number itself, such as; 153=1+5+3?, then 153 is a "narcissus number".
/*
In number theory, narcissus numbers (narcissistic number) are also known as narcissism numbers, self-power numbers, Armstrong numbers, or Armstrong numbers (Armstrong number), which refers to an n-digit number whose number is n and equal to the number.
For example, 153, 370, 371 and 407 are three-digit daffodils, each of which has a cubic sum equal to that number:
153 = 1^3 + 5^3 + 3^3.
370 = 3^3 + 7^3 + 0^3.
371 = 3^3 + 7^3 + 1^3.
407 = 4^3 + 0^3 + 7^3.
*/
C Language: Find all the "daffodils" between 0~999 and output