/*File : force2.c Calculate the peicewise time force. The formulas depend on wether time t is 0<=t<=3 or t>0*/ #include #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; }