Advertisement
luizaspan

Corpos em queda livre II

Apr 30th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. // Corpos em queda livre com v0 diferente de zero e theta0=0
  2. // Dada a distância percorrida em x, qual a altura em que o corpo foi lançado?
  3.  
  4. // y=y0+(tg(theta0)*x)-g*x*x/(2*pow(v0,2))
  5.  
  6. #include <stdio.h>
  7. #include <math.h>
  8.  
  9. #define g 9.8
  10. #define y0 20
  11. #define v0 5
  12.  
  13. int main(void)
  14. {
  15.  
  16.   float tv,x,xmax;
  17.   float y=y0;
  18.  
  19.   tv=sqrt(2*y0/g);
  20.   xmax=v0*tv;
  21.   printf("x(m)\t y(m)\n");
  22.  
  23.   for (x=0;x<=xmax;x+=0.5)
  24.     {
  25.       y=y0-g*x*x/2./powf(v0,2); // powf = pow pra float
  26.       printf("%.2f\t %f\n",x,y);
  27.     }
  28.  
  29.   return 0;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement