Advertisement
Guest User

Untitled

a guest
May 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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.  
  19. printf("Ingrese posicion inicial, velocidad y tiempo: \n"); /*Se asume que todos los datos ingresados por el usuario estan en las mismas unidades, por eso no hay necesidad de conversión*/
  20. scanf("%lf %lf %lf",&xoa, &va, &ta);
  21. xfa = xoa+(va*ta);
  22. printf("La posicion final es: %lf \n", xfa);
  23.  
  24. break;
  25.  
  26. case 'B':
  27.  
  28. printf("Ingrese posicion inicial, velocidad, tiempo y aceleracion: \n");
  29. scanf("%lf %lf %lf %lf",&xob, &vb, &tb, &a);
  30. xfb = xob + (vb*tb) + ((1/2)*a*tb*tb);
  31. printf("La posicion final es: %lf \n", xfb);
  32.  
  33. break;
  34.  
  35. case 'C':
  36.  
  37. printf("Ingrese altura inicial y tiempo: \n");
  38. scanf("%lf %lf",&h, &tc);
  39. y = h - ((1/2)*G*tc*tc);
  40. printf("La posicion final es: %lf \n", y);
  41.  
  42. break;
  43.  
  44. }
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement