From cbe8da5f3bc40523f3ec235319bf9f9b34d3a5a2 Mon Sep 17 00:00:00 2001 From: fdai7615 Date: Tue, 7 Feb 2023 22:47:43 +0100 Subject: [PATCH] add Work --- src/funktion.c | 8 ++++++++ src/funktion.h | 1 + src/main.c | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 58c8832..51b27d4 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -383,4 +383,12 @@ double position(double x0, double v0, double a, double t) double force(double m, double a) { return m * a; +} +double work(double a, double d,double m) +{ + double result; + result = (m * a) * d; + printf("%f", result); + return result; + } \ No newline at end of file diff --git a/src/funktion.h b/src/funktion.h index 0aca77e..18b1fd1 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -69,5 +69,6 @@ double substraction_3Zahlen(double sZahl1,double sZahl2,double sZahl3); double velocity(double v0, double a, double t); double position(double x0, double v0, double a, double t); double force(double m, double a); +double work(double a, double d,double m) ; #endif diff --git a/src/main.c b/src/main.c index a973daa..e1e36ec 100644 --- a/src/main.c +++ b/src/main.c @@ -314,4 +314,12 @@ int main() m=getValue('M'); a=getValue('A'); force(m, a); + + printf("Gib die Beschleunigung a ein: "); + a=getValue('A'); + printf("Gib die Masse m ein: "); + m=getValue('M'); + printf("Gib die Strecke d ein: "); + d=getValue('D'); + work(a, d, m); }