summaryrefslogtreecommitdiff
path: root/accelmultiplefunctions.c
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-02-06 11:26:44 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-02-06 11:26:44 -0500
commit97a693d996c79fb2a008b19750d8bb45512e01a2 (patch)
tree6df17bfe7de7c59f7b1083828d71a91e61fae9fa /accelmultiplefunctions.c
downloadengr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.tar.gz
engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.tar.bz2
engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.zip
Inital commitHEADmaster
Diffstat (limited to 'accelmultiplefunctions.c')
-rw-r--r--accelmultiplefunctions.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/accelmultiplefunctions.c b/accelmultiplefunctions.c
new file mode 100644
index 0000000..2db46b8
--- /dev/null
+++ b/accelmultiplefunctions.c
@@ -0,0 +1,36 @@
+/* File: accelmultiplefunctions.c
+ Calculate acceleration
+ both force and acceleration are calculated using functions */
+
+#include <stdio.h>
+#define M_G 9.81
+
+//Calculate the force
+
+double force(double t)
+{
+ double p;
+ p = 4*(t-3)+20;
+ printf("Froce p=%f(N)\n",p);
+ return p;
+}
+
+double accel(double t, double mu, double m)
+{
+ double a,p;
+
+ p = force(t);
+ a = (p-mu*m*M_G)/m;
+ return a;
+}
+
+int main()
+{
+ double a, mu, m, t;
+
+ mu = 0.2;
+ m = 5;
+ t = 2;
+ printf("Acceleration a = %f (m/s^2)\n",accel(t,mu,m));
+ return 0;
+}