The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Just exercise B. Use exercise A as reference(c code attach). C programming with comments! Thanks :)
Â
/*----------------------------------------------------Name: Ijeoma ChikwekwemStudent ID: 8209468This program calculates the velocity and displacement ofan object moving at a constant velocity after a giventime t.------------------------------------------------------*/#include <stdio.h>#include <math.h>int main(void){//Variables declarationsdouble a,v0,t;double calculateVelocity(double v0, double a, double t);double calculateDisplacement(double v0, double a, double t);//initialize the variablesprintf("Please enter a time (sec.):\n");scanf("%lf",&t);printf("Please enter initial velocity (m/s):\n");scanf("%lf", &v0);printf("Please enter acceleration (m/s^2):\n");scanf("%lf",&a);//Printing the resultsprintf("\nResults:\nAfter time %.2f s, The velocity v=%3.2f (m/s) Thedistance x=%3.2f(m)\n",t,calculateVelocity(v0,a,t),calculateDisplacement(v0,a,t));return 0;}double calculateVelocity(double v0,double a,double t){double v;v=v0+a*t;return v;}double calculateDisplacement(double v0,double a,double t){double x;x=v0*t+0.5*a*t*t;return x;}
Â
Attachments: