Menu
Coddy logo textTech
flag Ar iconالعربيةdown icon

Right angle triangle

الدرس 16 من 20 في دورة ألغاز رياضية على Coddy.

تشكل ثلاثية فيثاغورس {a, b, c} مثلثاً قائم الزاوية. 

محيط المثلث قائم الزاوية، p، الذي تكون أطوال أضلاعه أعداداً صحيحة، {a, b, c}، هو المجموع، p = a+b+c.

أمثلة:

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

التحدي

متوسط

يوجد بالضبط ثلاثية فيثاغورس واحدة يكون فيها a + b + c = 1000.

اكتب دالة calcSpecialPythagoreanTriplet تعيد قائمة تحتوي على هذه الثلاثية.

جرّب بنفسك

#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;
}

جميع دروس ألغاز رياضية

5Diophantine Equation

IntroductionA problem

8Pythagorean triplet

IntroductionRight angle triangleCounting