Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It seems you figured it out :)
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, asd
is in meters. Also, if you are going to convertd
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 inconstant
. 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).
long long result = al * bl;
This is exactly where the job lies, you are suppose to implement the multiplication.
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.you're welcome, glad you figured that out! you weren't acheiving a
NT
with your originalwhile
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 thegarbage
left behind in the memory near where your allocation takes place. your environment happened to have accidental coverage, but anytime you don't have aNT
you are succeptible to this problem.I see that you've printfed them in your outside environment. Instead, try in on Codewars. ;)
printf
the input and the output of the two sample tests, then compare the length of your second output to its input...