/* June 09, 1998 */ /* Program to calculate the sides of a right triangle - postive values only */ #includemain () { /* declaration */ int m; int n; int side1; int side2; int hypotenuse; int temp; /* get user input */ printf("Enter value of m > "); scanf("%d", &m); printf("Enter value of n > "); scanf("%d", &n); if (m > n) { /* calculation */ side1 = m*m - n*n; side2 = 2 * m * n; hypotenuse = m * m + n * n; } else { /* switch m and n */ temp = n; n = m; m = temp; /* calculation */ side1 = m*m - n*n; side2 = 2 * m * n; hypotenuse = m * m + n * n; } /* display results */ printf("Side 1 is %d \nSide 2 is %d \nHypotenuse is %d \n", side1, side2, hypotenuse); }