Hello,

I'm trying to write a simple program that calculates projectile distance and time. I was given the basic equations but I'm writing something incorrectly because my output is currently zero. I have a feeling this may be an explicit type casting issue but I'm not sure what to do:

Code:

#include <stdio.h>
#include <math.h>
int main(void)
{
const double PI = 3.14, GRAVITY = 9.8;
double degrees = 0, velocity = 0, angle = 0, range = 0, time = 0 ;
printf("Enter the measure of the angle in degrees. \n");
scanf("%d", &angle);
printf("Enter the initial velocity. \n");
scanf("%d", &velocity);
angle = angle * (PI/180.0);
range = (sin(2 * angle)) * pow(velocity, 2)/ GRAVITY;
time = range/(velocity * (cos(angle)));
printf("The projectile will travel %d meters.\n", range);
printf("It will take %d seconds.\n", time);
return 0;
}

Can anyone offer hints as to how I should fix this?

Thanks in advance,

crazychile