# Pythagoras theorm

This is a discussion on Pythagoras theorm within the C++ Programming forums, part of the General Programming Boards category; Hi, im new to this and was wondering if anybody could give me a hand in writing a small prog. ...

1. ## Pythagoras theorm

Hi, im new to this and was wondering if anybody could give me a hand in writing a small prog. to handle Pythagoras theorm.I am still at the very early stages and would be very grateful if anyone could help me out.
All the best Rob.

2. What exactly are you having trouble with? Post your questions (along with your code) here...

3. k1^2 + k2^2 = h^2

4. Abrege's 3 Day Introductory Guide to Handling the Pythagoras theorm!

1. Find the squares of the two sides
3. Use the sqrt() function in math.h to find the square root of sum

5. or to put what Magos said simpler, a^2 + b^2 = c^2

6. Note that ^ is in C++ not the operator for power.

7. use the pow() function in math.h

pow(x, y) calculates the value of x raised to the yth power
i.e

length = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2) );