C# program For Pythagoras Theorem.

Sajjad Arif Gul - January 26, 2014 - 6 comments

Pythagoras Theorem

Pythagoras Theorem states that the square of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the other two sides. Wikipedia


if c denotes the length of the hypotenuse and a and b denote the lengths of the other two sides, the Pythagorean theorem can be expressed as the Pythagorean equation:

a^2 + b^2 = c^2

Now in below example we are trying to implement a C# program for Pythagoras Theorem.

Source Code:


C# program For Pythagoras Theorem

C# program For Pythagoras Theorem

The Pythagorean theorem takes its name from the ancient Greek mathematician Pythagoras (569 B.C.?-500 B.C.?), who was perhaps the first to offer a proof of the theorem. But people had noticed the special relationship between the sides of a right triangle long before Pythagoras. Ancient clay tablets from Babylonia indicate that the Babylonians in the second millennium B.C., 1000 years before Pythagoras, had rules for generating Pythagorean triples, understood the relationship between the sides of a right triangle, and, in solving for the hypotenuse of an isosceles right triangle, came up with an approximation of accurate to five decimal places. Source.


Author avatar

Sajjad Arif Gul

Hi! I am Sajjad Arif Gul, Software Engineer, Web & Mobile Developer from Karachi Pakistan. I love sharing my knowledge that could possibly help someone’s life in some capacity. Happy Coding.

Related posts


  1. Thanks for this console application

  2. donald dain

    Thank you for this pythagoras formula. I was struggling to understand & develop it in a console app. Also your web site is very cool. I’m impressed by the details that you have on this website. It reveals how nicely you understand this C# programming. You, my pal, ROCK!

  3. Henry Romero

    Hi this website is really informative. I’ll be grateful if you continue this in future. A lot of people will be benefited from your writing. Cheers!

  4. Wow, that’s what I wass searching for, what a data!
    existing here att this web site, thanks admin of this web site.

  5. Natan

    Hello, I have a question, what does the sqh mean in the script.

Post a Comment

Your email address will not be published. Required fields are marked *