summaryrefslogtreecommitdiff
path: root/force2.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 /force2.c
downloadengr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.tar.gz
engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.tar.bz2
engr0016-97a693d996c79fb2a008b19750d8bb45512e01a2.zip
Inital commitHEADmaster
Diffstat (limited to 'force2.c')
-rw-r--r--force2.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/force2.c b/force2.c
new file mode 100644
index 0000000..8806617
--- /dev/null
+++ b/force2.c
@@ -0,0 +1,25 @@
+/*File : force2.c Calculate the peicewise time force. The formulas depend on wether time t is 0<=t<=3 or t>0*/
+#include <stdio.h>
+#define M 3
+
+int main()
+{
+
+ double p, t;
+ printf("Please input time in seconds: ");
+ scanf("%lf",&t);
+ if(0<=t && t<=M){
+ p = 20;
+ printf("Force p = %f (N)\n",p);
+ }
+ else if(t>3)
+ {
+ p = 4*(t+2);
+ printf("Force p = %f (N)\n",p);
+ }
+ else
+ {
+ printf("Invalid input, time is never negitive\n");
+ }
+ return 0;
+}