Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int m, n;
- printf("Enter m: ");
- scanf("%d", &m);
- printf("Enter n: ");
- scanf("%d", &n);
- if(m <= n)
- {
- printf("m needs to be bigger than n. Quitting.");
- return 0;
- }
- int side1, side2, hypotenuse;
- side1 = pow(m, 2) - pow(n, 2);
- side2 = 2*(m*n);
- hypotenuse = pow(m, 2) + pow(n, 2);
- printf("The pythagorean triple is: side1 = %d, side2 = %d, hypotenuse = %d.", side1, side2, hypotenuse);
- return 0;
- }
Add Comment
Please, Sign In to add comment