Question bank › Math
Dsa Math Medium

Pythagorean Triples Finder

Write a function that finds all Pythagorean triples (a, b, c) such that a^2 + b^2 = c^2, where a, b, and c are integers less than a given limit. The order of a and b does not matter. Print each unique triple in increasing order. Input format: A single integer, the limit for a, b, and c. Output format: Print each Pythagorean triple in the format 'a b c', with one triple per line. Each number in the triple should be separated by a space. Example: Input: 10 Output: 3 4 5 6 8 10

Key concepts

pythagorean theoremtriplesmath

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.