hypo.c (503B)
1 /* Esercizio 5.15 */ 2 3 #include <stdio.h> 4 #include <math.h> 5 6 double hypotenuse(double, double); 7 8 int main() 9 { 10 int i; 11 double side1, side2; 12 13 for(i = 1; i <= 3; i++) { 14 printf("Give me sides (s1 s2): "); 15 scanf("%lf%lf", &side1, &side2); 16 17 printf("Side1\tSide2\tHypotenuse\n"); 18 printf("%.1f\t%.1f\t%.1f\n", side1, side2, hypotenuse(side1, side2)); 19 } 20 21 return 0; 22 } /* E0F main */ 23 24 double hypotenuse(double x, double y) 25 { 26 return sqrt(x*x + y*y); 27 } /* eof hypotenuse() */