c – Calculate firing angle and maximum horizontal distance from max height and initial velocity

So, I’m writing a C program that asks the user to input a max height and an initial velocity. The program then outputs a desired firing angle for an object, and the maximum horizontal distance. My code runs fine and lets me input numbers, but the output it gives is incorrect. This makes me think the formulas I put in to define the variables theta and maxd aren’t formatted correctly, but no matter how I format them I can’t get the right output. This is my code:

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

#include <math.h>

int main(void) {

    double h, g, v, theta, maxd;
    g = 9.8;
    printf("Enter a maximum height (in m):");
    scanf("%lf", &h);
    printf("Enter an initial velocity (in m/s):");
    scanf("%lf", &v);

    theta = asin(sqrt((2 *g *h) / pow(v, 2)));
    printf("We should fire the ball at an angle of: %lfn", theta);

    maxd = (pow(v, 2) * sin(2 * theta)) / g;
    printf("The maximum horizontal distance is: %lf", maxd);

    return 0;
}