
Andy C. answered 10/14/18
Math/Physics Tutor
#include <stdio.h>
#define G (9.81f)
int main()
{
float v;
float t=0;
float h;
float maxT;
printf(" Please input the intial veloctiy :>");
scanf("%f",&v);
maxT = v/G;
printf(" max height occurs at t = %6.2f \n",maxT);
while (t< maxT)
{
h = v*t - 0.5*G*t*t;
t = t + 0.1;
printf(" t = %6.2f and height h = %6.2f \n",t,h);
}
printf(" Max height is %8.3f \n",h);
printf(" Max height at %8.3f \n",v*maxT-0.5*G*maxT*maxT);
}