Hey guys, ive just taken up a programming course, and i cant figure out whats wrong with this code, could someone please shed some light on this? After I input the angle, the program closes....it doesnt give me the output(range).
I am using microsoft visual studio to debug/compile the code
thanks!
/*Author: ------------
Date: Sept 12, 2010
Purpose: calculate the range given velocity and angle of launch
*/
#include <stdio.h>
#include <math.h>
#define ACCEL_GRAV 9.81
int main( void )
{
double initialspeed;
double range;
double angle;
printf( "Input Initial speed m/s \n" );
scanf( "%lf", &initialspeed );
printf( "Input Angle in (radians)\n" );
scanf( "%lf", &angle );
range = ( initialspeed * initialspeed )
/ ACCEL_GRAV * sin( 2 * angle );
printf( "Final Range Is: %f ", range );
return 0;
}
btw: the forum kinda ruined my indentations
I am using microsoft visual studio to debug/compile the code
thanks!
/*Author: ------------
Date: Sept 12, 2010
Purpose: calculate the range given velocity and angle of launch
*/
#include <stdio.h>
#include <math.h>
#define ACCEL_GRAV 9.81
int main( void )
{
double initialspeed;
double range;
double angle;
printf( "Input Initial speed m/s \n" );
scanf( "%lf", &initialspeed );
printf( "Input Angle in (radians)\n" );
scanf( "%lf", &angle );
range = ( initialspeed * initialspeed )
/ ACCEL_GRAV * sin( 2 * angle );
printf( "Final Range Is: %f ", range );
return 0;
}
btw: the forum kinda ruined my indentations