Only the C language result is 0

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

I used the formula for finding parabolic motion, but I don't think there's a problem, but the result is only 0. What's the problem?

%%file task6.c

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

int main(void) {
    double t, V0, d, g;
    double Vx, x, Vy, y;

    g = 9.8;
    Vx = (V0*cos(d*M_PI/180));
    x = ((V0*cos(d*M_PI/180))*t);
    Vy = (V0*sin(d*M_PI/180) - g*t);
    y = ((V0*sin(d*M_PI/180))*t - 1/2*g*t*t);

    printf("Enter the first speed.(m/s)");
    scanf("%lf", &V0);
    printf("Enter the angle.(°)");
    scanf("%lf", &d);
    printf("Enter the time.(s)");
    scanf("%lf", &t);

    printf("Vx = %lf\n", Vx);
    printf("x = %lf\n", x);
    printf("Vy = %lf\n", Vy);
    printf("y = %lf\n", y);

    return 0;
}

c

2022-09-20 14:31

1 Answers

When calculating Vx, V0 is 0.


2022-09-20 14:31

If you have any answers or tips


© 2022 pinfo. All rights reserved.