From 21014a487c258d92736abad083b84e7809bf5db8 Mon Sep 17 00:00:00 2001 From: fdai7615 Date: Tue, 7 Feb 2023 23:54:35 +0100 Subject: [PATCH] add Power --- src/funktion.c | 7 +++++++ src/funktion.h | 1 + src/main.c | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 619a092..df0f35d 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -387,4 +387,11 @@ double force(double m, double a) double work(double a, double d,double m) { return (m * a) * d; +} +double power(double a, double m, double d, double t) +{ + double result; + result = ((m * a) * d) / t; + printf("%f", result); + return result; } \ No newline at end of file diff --git a/src/funktion.h b/src/funktion.h index 18b1fd1..2f73ce7 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -70,5 +70,6 @@ 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) ; +double power(double a, double m, double d, double t); #endif diff --git a/src/main.c b/src/main.c index 0098eee..8aa43be 100644 --- a/src/main.c +++ b/src/main.c @@ -319,4 +319,14 @@ int main() m=getValue('M'); d=getValue('D'); work(a, d, m); + + 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'); + printf("Gib die Zeit t ein: "); + t=getValue('T'); + power(a,m,d,t); }