From 6d2b4525518c0012f8f94f2b8c29423fa8d465c8 Mon Sep 17 00:00:00 2001 From: Fdai7396 Date: Tue, 7 Feb 2023 18:53:04 +0100 Subject: [PATCH] add viereckUmfang --- src/funktion.c | 3 +++ src/funktion.h | 1 + src/main.c | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 57bfdf9..85978a8 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -333,4 +333,7 @@ double dreieckUmfangn(double a, double b, double c) { } double viereckFlaeche(double a, double b) { return a * b; +} +double viereckUmfang(double a, double b){ + return (2 * a) + (2 * b); } \ No newline at end of file diff --git a/src/funktion.h b/src/funktion.h index a462b49..36467ba 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -58,5 +58,6 @@ double kreisUmfang(double r); double dreieckFlaeche(double a, double b, double c); double dreieckUmfangn(double a, double b, double c); double viereckFlaeche(double a, double b); +double viereckUmfang(double a, double b); #endif diff --git a/src/main.c b/src/main.c index 3c2513f..d95dd59 100644 --- a/src/main.c +++ b/src/main.c @@ -262,4 +262,9 @@ int main() a = getValue('a'); b = getValue('b'); viereckFlaeche(a,b); + + a = getValue('a'); + b = getValue('b'); + viereckUmfang(a,b); + printf("Der Umfang des Vierecks betraegt: %lf\n", (2 * a) + (2 * b)); }