2025-03-06 22:45:14 +08:00

20 lines
473 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*-------------------------------------------------------
编程输出500以内的“水仙花数”。“水仙花数”是一个三位数其各位数字立方和等于该数本身15313+53+33使用for循环
-------------------------------------------------------*/
#include <stdio.h>
main()
{
int a,b,c,i;
/**********Program**********/
for(i=100;i<500;i++){
a = i%10;
b = i%100/10;
c = i/100;
if(a*a*a + b*b*b + c*c*c == i)
/********** End **********/
printf("%d\n",i);
}
}