阅读背景:

四叶玫瑰花数_明月山涧照的博客_四叶玫瑰数为什么浪漫

来源:互联网 
#include<stdio.h>
#define N 9999
int get_count(int result[], int n)
{
    if(result==nullptr)
        return 0;
	int a, b, c, d;
	int sum;
	int  i, j;
	int count = i = 0;
	for (j = 1000; j < n; j++)
	{
		a = j / 1000;
		b = (j - a * 1000) / 100;
		c = (j - a * 1000 - b * 100) / 10;
		d = j % 10;
		sum = a*a*a*a + b*b*b*b + c*c*c*c + d*d*d*d;
		if (sum == j)
		{

			result[i] = j;
			i++;
			count++;

		}
	}
	return count;
}
int main(void)
{
	
	int result[10];
	int i, c;
	c = get_count(result, N);
	for (i = 0; i<c; i++)
		printf("%d\n", result[i]);
	return 0;
}#include<stdio.h>
#define N 9999
int get_count(



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: