47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
int main(void)
|
|
{
|
|
int nombreSaisi;
|
|
int carre1;
|
|
int carre2;
|
|
int carre3;
|
|
int carre4;
|
|
printf("Saisissez un entier naturel : ");
|
|
scanf("%d", &nombreSaisi);
|
|
for (carre1 = 0; carre1 * carre1 * 4 < nombreSaisi; carre1 += 1)
|
|
{
|
|
}
|
|
for (; carre1 * carre1 <= nombreSaisi; carre1 += 1)
|
|
{
|
|
for (carre2 = 0; carre1 * carre1 + carre2 * carre2 * 3 < nombreSaisi; carre2 += 1)
|
|
{
|
|
}
|
|
for (; carre1 * carre1 + carre2 * carre2 <= nombreSaisi; carre2 += 1)
|
|
{
|
|
for (carre3 = 0; carre1 * carre1 + carre2 * carre2 + carre3 * carre3 * 2 < nombreSaisi; carre3 += 1)
|
|
{
|
|
}
|
|
for (; carre1 * carre1 + carre2 * carre2 + carre3 * carre3 <= nombreSaisi; carre3 += 1)
|
|
{
|
|
for (carre4 = 0; carre1 * carre1 + carre2 * carre2 + carre3 * carre3 + carre4 * carre4 < nombreSaisi; carre4 += 1)
|
|
{
|
|
}
|
|
if (carre1 * carre1 + carre2 * carre2 + carre3 * carre3 + carre4 * carre4 == nombreSaisi)
|
|
{
|
|
printf("%d", nombreSaisi);
|
|
printf(" = ");
|
|
printf("%d", carre1);
|
|
printf("^2 + ");
|
|
printf("%d", carre2);
|
|
printf("^2 +");
|
|
printf("%d", carre3);
|
|
printf("^2 + ");
|
|
printf("%d", carre4);
|
|
printf("^2\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return EXIT_SUCCESS;
|
|
} |