#include <stdio.h>
#include <math.h>


int main()
{
    double a = 9.8;  // units = meters
    
    double radians;
    double angle, velocity;
    double vx, vy, x, y;
    float time;
    FILE *outfile;
    
    outfile = fopen("trajC.out", "w");
    
    printf("Enter velocity: ");
    scanf("%lf", &velocity);
    
    printf("Enter angle: ");
    scanf("%lf", &angle);
    
    radians = angle*M_PI/180.0;
    
    vx = velocity * cos(radians);
    vy = velocity * sin(radians);
    
    for(time=0; time < .5; time += .01)
    {
        x = vx * time;
	y = vy * time - 0.5 * a * time * time;
	printf ("Time: %lf  x: %lf  y: %lf\n", time, x, y);
        fprintf (outfile, "Time: %lf  x: %lf  y: %lf\n", time, x, y);
    }
    
    printf("Vx = %lf  Vy = %lf  Veloc=%lf  Angle=%lf  Rad=%lf\n", 
                      vx, vy, velocity, angle, radians);
    fprintf(outfile,     
    "Vx = %lf  Vy = %lf  Veloc=%lf  Angle=%lf  Rad=%lf\n", 
                      vx, vy, velocity, angle, radians);
		     
    fclose(outfile);
    return 0;
}	
    
    
    


syntax highlighted by Code2HTML, v. 0.9.1