Computer Science Homework Solutions
Problem
#3909

Writing a program to calculate pythagorean triples.

A right triangle can have sides that are all integers. The set of three integer values for the sides of a right triangle is called a Pythagorean triple. These three sides must satisfy the relationship that the sum of the squares of two of the sides is equal to the square of the hypotenuse. Write a program to find all Pythagorean triples for side1, side2 and the hypotenuse. All must be no larger then 500. Use a triple-nested for/next loop that tries all possibilities.

Solution
What is this?
By OTA - Overall OTA Rating
Jamshed Dastur, MSc (IP) - n/a
Purchase Cost Now
$2.19 CAD (was ~$3.99)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Pythagorean theorem formula - Calculate the hypotenuse of a right-angled triangle. The Pythagorean theorem. The application should also allow the user to perform a cylinder volume calculation. Pythagorean theorem formula: a ...
  • Adding tables - Use a bit of personal freedom with this: Add a table to the attached document "solution" using at least two tables with any numbers you can think of, doesn't matter really. Be sure to include heade ...
  • Create a Multiplication Table using Nested for...Next Loops - Design and develop a program that creates a complete set of multiplication tables where both the multiplicand and the multiplier vary from 1 through 12. The table should display as 144 rows in a list ...
  • Threads - C program that creates three pthreads, each of which executes a different slave process. The first slave prompts the user for two integers x and n and the uses a loop to calculate xn and outputs t ...
  • Operations and Expressions - Write a program to read the lengths of the two legs of a right triangle and to calculate and display the area of the triangle (one-half the product of the legs) and the length of the hypotenuse (squar ...
Browse