这里不能求作业的,去百度吧,
#include <stdio.h> unsigned cube(int n) { return n * n * n; } int main(void) { int i, one, ten, hundred; for(i = 100; i < 1000; i++) { one = i % 10; ten = i / 10 % 10; hundred = i / 100 % 10; if(cube(one) + cube(ten) + cube(hundred) == i) printf("%d\n", i); } return 0; }