/*
 *	This program tests the hyp() function
 *	and must be compiled using -lm.
 */

#include <stdio.h>
#include <math.h>

main()
{
	double hyp();		/* Declare the hyp() func. as double */
	float a = 7, b = 12;	/* Declare and initialize triangle's legs */

	printf("The legs of the triangle are 7, and 12\n");
	printf("The hypotenuse is %f.\n", hyp(a, b));
      }

/*
 *	This funtion calculates the length of
 *	a right triangle's hypotenuse given
 *	the triangles legs
 */

double hyp(leg1, leg2)
double leg1, leg2;			/* Declare hyp's args */

{
	double hypotenuse;

	hypotenuse = sqrt((leg1 * leg1) + (leg2 * leg2)); /* Calculate ans */
	return(hypotenuse);

      }
