输入一个三位数,其各位数字的立方和等于该数本身

时间:2023-01-31 00:13:05
#include<stdio.h>

int main()
{
	int i,j,k,n;
	printf("parcissus numbers are:\n");
	for(n = 100;n <1000;n ++)
	{
		i = n/100;
		j = n/10 - i*10;
		k = n%10;
		if(n == i*i*i + j*j*j + k*k*k)
		{
			printf("%d\n",n);
		}
	}
	printf("\n");
	return 0;
}


 

 

eg:153=1^3+5^3+3^3