alegomaster

February 22nd, 2012, 01:41 AM

I am working on a practice question for programming and it tells me to implement a specific mathematical function in it. The issue is I am always getting 0 for my output. The code is below:

#include <stdio.h>

#include <math.h>

int main ()

{

double A;

double H;

double M;

double t=0;

scanf("%lg", &H);

scanf("%lg", &M);

while (M!=t)

{

A= -6*pow(t,4)+H*pow(t,3)+2*pow(t, 2)+t; //The mathematical Function

if (A<=0)

{

printf("You touched the ground at: %lg", t);

goto end;

}

else

{

t++;

}

}

printf("The ballon didn't touch the ground");

end:

return 0;

}

I am wondering if someone can help me with this code, I am not familiar with using algebra in C

#include <stdio.h>

#include <math.h>

int main ()

{

double A;

double H;

double M;

double t=0;

scanf("%lg", &H);

scanf("%lg", &M);

while (M!=t)

{

A= -6*pow(t,4)+H*pow(t,3)+2*pow(t, 2)+t; //The mathematical Function

if (A<=0)

{

printf("You touched the ground at: %lg", t);

goto end;

}

else

{

t++;

}

}

printf("The ballon didn't touch the ground");

end:

return 0;

}

I am wondering if someone can help me with this code, I am not familiar with using algebra in C