Advertisement
Guest User

Untitled

a guest
May 21st, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <stdio.h>
  2. #define G 9.8
  3.  
  4. int main() {
  5.  
  6. double xfa, xoa, va, ta, xfb, xob, vb, tb, a, y, h, tc;
  7. char resultado;
  8.  
  9. printf("Ingrese la letra del tipo de movimiento que realiza la partícula: \n");
  10. printf(" (A)>MRU \n");
  11. printf(" (B)>MRUV \n");
  12. printf(" (C)>CAIDA LIBRE \n");
  13. scanf("%c", &resultado);
  14.  
  15. switch(resultado) {
  16.  
  17. case 'A':
  18. xfa = xoa+(va*ta);
  19. printf("Ingrese posicion inicial, velocidad y tiempo: \n");
  20. scanf("%lf %lf %lf",&xoa, &va, &ta);
  21. printf("La posicion final es: %lf \n", xfa);
  22.  
  23. break;
  24.  
  25. case 'B':
  26. xfb = xob + (vb*tb) + ((1/2)*a*tb*tb);
  27. printf("Ingrese posicion inicial, velocidad, tiempo y aceleracion: \n");
  28. scanf("%lf %lf %lf %lf",&xob, &vb, &tb, &a);
  29. printf("La posicion final es: %lf \n", xfb);
  30.  
  31. break;
  32.  
  33. case 'C':
  34. y = h - ((1/2)*G*tc*tc);
  35. printf("Ingrese altura inicial y tiempo: \n");
  36. scanf("%lf %lf",&h, &tc);
  37. printf("La posicion final es: %lf \n", y);
  38.  
  39. break;
  40.  
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement