closed account (*iyvp92yv*)

The Pythagorean theorem states that the sum of the squares of the sides

of a right triangle is equal to the square of the hypotenuse. For example,

if two sides of a right triangle have lengths 3 and 4, then the hypotenuse

must have a length of 5. The integers 3, 4, and 5 together form a

Pythagorean triple. There is an infinite number of such triples. Given two positive integers, m and n, where m> n, a Pythagorean triple can be

generated by the following formulas:

side = m2 - n2

side2 = 2mn

hypotenuse = square root (side 1^2 + side 2 ^2)

write a c++ program that reads in values of m and n and prints the values of the Pythagorean. Also, make the program accommodate when m is less than n

of a right triangle is equal to the square of the hypotenuse. For example,

if two sides of a right triangle have lengths 3 and 4, then the hypotenuse

must have a length of 5. The integers 3, 4, and 5 together form a

Pythagorean triple. There is an infinite number of such triples. Given two positive integers, m and n, where m> n, a Pythagorean triple can be

generated by the following formulas:

side = m2 - n2

side2 = 2mn

hypotenuse = square root (side 1^2 + side 2 ^2)

write a c++ program that reads in values of m and n and prints the values of the Pythagorean. Also, make the program accommodate when m is less than n

closed account (*iyvp92yv*)

sorry forgot to ask the question: how an I accommodate that m is less than n should I display an error message?

Last edited on

"Accommodate" implies handling the issue, not simply recognizing it before failing.

closed account (*iyvp92yv*)

ok thank you and sorry if my question is weird I am fairly new to problem-solving with C++

Registered users can post here. Sign in or register to post.