Guest User

Untitled

a guest
Nov 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int m, n;
  7.  
  8.     printf("Enter m: ");
  9.     scanf("%d", &m);
  10.     printf("Enter n: ");
  11.     scanf("%d", &n);
  12.  
  13.     if(m <= n)
  14.     {
  15.         printf("m needs to be bigger than n. Quitting.");
  16.         return 0;
  17.     }
  18.  
  19.     int side1, side2, hypotenuse;
  20.  
  21.     side1 = pow(m, 2) - pow(n, 2);
  22.     side2 = 2*(m*n);
  23.     hypotenuse = pow(m, 2) + pow(n, 2);
  24.  
  25.     printf("The pythagorean triple is: side1 = %d, side2 = %d, hypotenuse = %d.", side1, side2, hypotenuse);
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment