Menu
Coddy logo textTech

Right angle triangle

Lektion 16 von 20 im Kurs Mathematische Rätsel von Coddy.

Ein pythagoreisches Tripel {a, b, c} bildet ein rechtwinkliges Dreieck. 

Der Umfang, p, eines rechtwinkligen Dreiecks mit ganzzahligen Seitenlängen, {a, b, c}, ist die Summe, p = a+b+c.

Beispiele:

  • {3, 4, 5} mit p = 12,
  • {30, 40, 50}, {20, 48, 52}, {24, 45, 51} mit p = 120.
challenge icon

Aufgabe

Mittel

Es existiert genau ein pythagoreisches Tripel, für das a + b + c = 1000 gilt.

Schreiben Sie eine Funktion calcSpecialPythagoreanTriplet, die eine Liste mit diesem Tripel zurückgibt.

Probier es selbst

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "solution.h"

int main() {
    int rs = 0;
    int* r = calcSpecialPythagoreanTriplet(&rs);
    for (int i = 0; i < rs; i++) {
        if (i > 0) printf(" ");
        printf("%d", r[i]);
    }
    printf("\n");
    return 0;
}

Alle Lektionen in Mathematische Rätsel

5Diophantine Equation

IntroductionA problem

8Pythagorean triplet

IntroductionRight angle triangleCounting