Ad
  • Default User Avatar

    It seems you figured it out :)

  • Custom User Avatar

    Well for one, d is given in meters, and you treat it as if it is a velocity. You don't convert a variable in meters to m/s. Your way of converting looks to be a conversion from km/h to m/s, which would not work in this case, as d is in meters. Also, if you are going to convert d to km in order to solve the equation, you must also convert gravity from m/s/s to km/h/h. Otherwise, you'll have a relatively unusable number spat out of your equation.

    Also, it doesn't look like a variable G is assigned before using it in constant. I'm a little confused about that.

    And it looks like you forgot to add the b^2 part of the quadratic equation, as a part of the determinant. I would take another look at the quadratic formula Here, make sure all of my variables are converted correctly, and try again. Also, look into slightly different ways of doing this. (You don't have to convert before you do the equation).

  • Custom User Avatar

    long long result = al * bl;

    This is exactly where the job lies, you are suppose to implement the multiplication.

  • Default User Avatar

    Hi @wanderer12, when you see char * as the start of the declaration, you should expect to return a pointer to a dynamically allocated C-string.

  • Default User Avatar

    you're welcome, glad you figured that out! you weren't acheiving a NT with your original while statement. adding '\0' at the end of your original code would have worked. but the reason your code appeared to work on the outside environment has to do with the garbage left behind in the memory near where your allocation takes place. your environment happened to have accidental coverage, but anytime you don't have a NT you are succeptible to this problem.

  • Default User Avatar

    I see that you've printfed them in your outside environment. Instead, try in on Codewars. ;)

  • Default User Avatar

    printf the input and the output of the two sample tests, then compare the length of your second output to its input...