C languageC SolutionChapter 4Programming

Q22 Write a program to generate all Pythagorean Triplets with side length less than or equal to 30.

Program: 115

Write a c program to generate all Pythagorean Triplets with side length less than or equal to 30.

a2 + b2 = c2

Output:

(3, 4, 5)
(4, 3, 5)
(5, 12, 13)
(6, 8, 10)
(7, 24, 25)
(8, 6, 10)
(8, 15, 17)
(9, 12, 15)
(10, 24, 26)
(12, 5, 13)
(12, 9, 15)
(12, 16, 20)
(15, 8, 17)
(15, 20, 25)
(16, 12, 20)
(16, 30, 34)
(18, 24, 30)
(20, 15, 25)
(20, 21, 29)
(21, 20, 29)
(21, 28, 35)
(24, 7, 25)
(24, 10, 26)
(24, 18, 30)
(28, 21, 35)
(30, 16, 34)

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.