title: cannon projectile program using c programming
body: <p>I am making a program that let's users enter velocity and angle and then program calculates the vertical and horizontal component and now i am trying to make the program also calculate time of flight (TOF). The equation is t=2*Vo*sin(ang)/g.
  but i am stuck on how to implement it. I have tried to implement it but i am not so successful.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  
  void components(float Vo, float ang, float* outpVx, float* outpVy,float* X,float* Y, float a,float t)
  {
      t=0.1;
      a=-9.81;
  
      *outpVx=Vo*cos(ang);
      *outpVy=Vo*sin(ang);
  
      *X=*outpVx*t;
      *Y=*outpVy*t+(0.5*a*(t*t));
  
  }
  
  void TOF(float Vo,float ang,float g,float t)
  {
      g=9.81;
      main(Vo,ang);
      t=(2*Vo*sin(ang))/g;
  
  
  }
  
  int main(void)
  {
      float Vo,ang;
      float outVx=0.0;
      float outVy=0.0;
      float X;
      float Y;
      float t=0.1;
      float a=-9.81;
      float g= 9.81;
  
      printf("\nEnter Velocity:\n");
      scanf("%f",&amp;Vo);
      printf("\nEnter Angle:\n");
      scanf("%f",&amp;ang);
  
      components(Vo,ang, &amp;outVx, &amp;outVy, &amp;X, &amp;Y,a,t);
      printf("Horizontal \t Vertical\n");
      printf("%f \t %f", X, Y);
  
      TOF(t,g,Vo,ang);
      printf("%f",t);
  
  
  return 0;
  } 
  </code></pre>
  
  <p>some guidance would be much appreciated. </p>