From 3da73be20db34473cee55c4fa270219f0af21bd5 Mon Sep 17 00:00:00 2001 From: fdai7615 Date: Tue, 7 Feb 2023 22:41:41 +0100 Subject: [PATCH] add Force --- src/funktion.c | 7 +++++++ src/funktion.h | 1 + src/main.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 814bb06..f2df238 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -379,4 +379,11 @@ double velocity(double v0, double a, double t) double position(double x0, double v0, double a, double t) { return x0 + v0 * t + 0.5 * a * t * t; +} +double force(double m, double a) +{ + double result; + result = m * a; + printf("%f", result); + return result; } \ No newline at end of file diff --git a/src/funktion.h b/src/funktion.h index 3d02d4b..0aca77e 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -68,5 +68,6 @@ double substraction_2Zahlen(double sZahl1,double sZahl2); 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); #endif diff --git a/src/main.c b/src/main.c index 8aa9dcd..16ec372 100644 --- a/src/main.c +++ b/src/main.c @@ -310,4 +310,10 @@ int main() a=getValue('A'); t=getValue('T'); position(x0, v0, a, t); + + printf("Gib die Masse m ein: "); + m=getValue('M'); + printf("Gib die Beschleunigung a ein: "); + a=getValue('A'); + force(m, a); }