• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pythagoras theorem code  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, I just wanna code for the following query
The Pythagorean Theorem holds that the length of the hypotenuse (z) of a right triangle with sides x and y is given by the following formula:
x2 + y2 = z 2
As it turns out, there are an infinite number of triangles in which all three of these edge lengths are integers, including the following examples:
3*2 + 4*2 = 5*2
12*2 + 5*2 = 13*2
Thanks in advance.
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

... and you would like to have code that generates those number triplets? What do you have so far? If you haven't started, what ideas have you had?
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first steps are always the same. try and figure out how YOU would solve it, with paper and pencil. Don't even consider writing a line of code until you can solve it yourself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!