![]() ![]() | functions/input-parameter-problems/p1.c - Det gode program. | Lektion 5 - slide 26 : 30 Program 6 |
/* OK - The good and natural solution - with use of parameters and return value */ #include <stdio.h> #include <math.h> double hypotenuse (double katete1, double katete2){ return sqrt(katete1 * katete1 + katete2 * katete2); } int main(void) { double k1, k2; printf("Indlaes to kateter: "); scanf("%lf %lf", &k1, &k2); printf("Katete1: %f, katete2: %f, hypotenuse: %f\n", k1, k2, hypotenuse(k1, k2)); }