Dsa
Math
Easy
Square Sum Finder
Write a program that takes an integer N and finds all unique pairs of positive integers (x, y) such that x^2 + y^2 = N. Output the pairs in ascending order. If no such pairs exist, output 'No pairs found'.
Input Format:
- A single integer N (1 <= N <= 10000)
Output Format:
- Each pair (x, y) in ascending order on a new line, or 'No pairs found' if no pairs exist.
Example:
Input:
10
Output:
(1, 3)
(3, 1)
Key concepts
mathsquares
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