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

int main()
{
    double a = 9.8;  // units = meters
    
    double radians;
    double angle, velocity;
    double vx, vy, x, y;
    double dt=.01, dx, dy;
    float time;
    
    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);
    
    x = 0.0;
    y = 0.0;
    dx = vx * dt;     
    dy = vy * dt - 0.5 * a * dt * dt;
    for(time=0; time < .5; time += dt)
    {
	if (x > 25) 
	   dx = dx * -1;
	x = x + dx;
	y = y + dy;
	printf ("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);
    return 0;
}	
    
    
    


syntax highlighted by Code2HTML, v. 0.9.1