![]() ![]() ![]() | functions/input-parameter-problems/p3.c - En void funktion som printer - burde returnere sit resultat. | Lektion 5 - slide 26 : 30 Program 2 |
/* Void function som printer i stedet for blot at returnere */ #include <stdio.h> #include <math.h> void hypotenuse (double katete1, double katete2){ printf("Hypotenuse: %f", 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)); /* Problem with call of hypotenuse */ }