DevJourney · code I wrote while learning

Pythagorean Triples

2 items

README.md

Pythagorean Triples

Single File Programming Question

Problem Statement

Laura is learning about Pythagorean triples in her math class. She wants to create a program to determine whether a set of three integers forms a Pythagorean triple. Implement a program using the PythagoreanCalculator class to input the sides of a triangle and determine if it is a Pythagorean triple or not.

Note:

The condition for the Pythagorean triple is:

a2 + b2 = c2 (or) a2 + c2 = b2 (or) b2 + c2 = a2

Input:

format :

The input consists of three space-separated integers a, b, and c representing the sides of a triangle, separated by a space.

Output:

format :

The output prints "The numbers a, b, c form a Pythagorean triple" or "The numbers a, b, c do not form a Pythagorean triple" based on the inputs.

Refer to the sample output for formatting specifications.

Code constraints :

The given test cases fall under the following constraints:

1 ≤ a, b, c ≤ 100

Sample test cases :

Input 1:

3 4 5

Output 1:

The numbers 3, 4, 5 form a Pythagorean triple

Input 2:

1 100 95

Output 2:

The numbers 1, 100, 95 do not form a Pythagorean triple

Input 3:

8 15 17

Output 3:

The numbers 8, 15, 17 form a Pythagorean triple