Tutorials Infos - Anleitungen - Hilfe - Dreamcodes
 

Tripel

#include

void main(void)
{

int oberGrenze,zahl1,zahl2,zahl3;
double i=0;



printf ("Bitte Zahl eingeben: \n");
scanf ("%i",&oberGrenze);
printf ("Es folgen die Tripel bis: %i\n", oberGrenze);

for (zahl1 = 1; zahl1 <= oberGrenze; zahl1++)
{
for (zahl2 = 1; zahl2 <= oberGrenze; zahl2++)
{
for (zahl3 = 1; zahl3 <= oberGrenze; zahl3++)
{
if ((zahl1*zahl1) == ((zahl2 * zahl2) + (zahl3 * zahl3)) /*&& (!(zahl2>zahl3))*/)
{
printf ("%i : %i : %i\n", zahl1,zahl2,zahl3);
}
i++ ;
}
}
}

printf("Der Computer hat die Zahlen %0.0lf mal miteinander verglichen", i);
}

 
ID: 322
eingestellt am: 12.03.2004
Autor: Semokum
Status zum lesen: Gast
gelesen: 4790
Webseite: www.dreamcodes.com
[Drucken]