title: C code to simulate parabolic trajectory of launched object terminates early
body: <p>This program simulates the parabolic trajectory of an object launched at an angle at a fixed vertical and horizontal velocity. It outputs data in coordinates displayed in the terminal console.</p>
  
  <p>However, the program outputs data only up to the second line and terminate, so there must be an error somewhere in the code. I cannot identify the error so I am requesting for help!</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
  
   int main(void) {
   float lvelox;
   float lveloy;
   float xcord;
   float ycord;
   int stepcount;
   int step = 0;
  
   /* Initializing velocity */
   {
     printf("Enter the initial h velocity of the ball:\n");
     scanf("%f", &amp;lvelox);
     printf("Enter the initial v velocity of the ball:\n");
     scanf("%f", &amp;lveloy);
   }
  
   /* Obtain number of steps */
   {
     printf("Enter the number of steps wanted:\n");
     scanf("%d", &amp;stepcount);
   }
  
   /* formula for calculating initial position */
     if ( step == 0 )
     {
     xcord = 0;
     ycord = 0;
     step = step + 1;
     printf("\n");
     printf("xcord, ycord, step\n");
     printf("\n");
     printf("%f, ", xcord);
     printf("%f, ", ycord);
     printf("%d\n", step);
     }
  
   /* Loop method */
     if ( step &lt; stepcount )
     {
     lveloy = lveloy - 9.81;
     xcord = xcord + lvelox;
     ycord = ycord + lveloy;
     step = step + 1;
     printf("%f, ", xcord);
     printf("%f, ", ycord);
     printf("%d\n", step);
  
     if ( ycord &lt; 0 )
     {
     lveloy = (lveloy * -1);
     lveloy = lveloy - 9.81;
     xcord = xcord + lvelox;
     ycord = ycord + lveloy;
     step = step + 1;
     printf("%f, ", xcord);
     printf("%f, ", ycord);
     printf("%d\n", step);
     }
     }
  
     if (step &gt;= stepcount)
     {
         return 0;
     }
  
   }
  </code></pre>