Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <stdio.h>
- #define G 9.8
- int main() {
- double xfa, xoa, va, ta, xfb, xob, vb, tb, a, y, h, tc;
- char resultado;
- printf("Ingrese la letra del tipo de movimiento que realiza la partícula: \n");
- printf(" (A)>MRU \n");
- printf(" (B)>MRUV \n");
- printf(" (C)>CAIDA LIBRE \n");
- scanf("%c", &resultado);
- switch(resultado) {
- case 'A':
- 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*/
- scanf("%lf %lf %lf",&xoa, &va, &ta);
- xfa = xoa+(va*ta);
- printf("La posicion final es: %lf \n", xfa);
- break;
- case 'B':
- printf("Ingrese posicion inicial, velocidad, tiempo y aceleracion: \n");
- scanf("%lf %lf %lf %lf",&xob, &vb, &tb, &a);
- xfb = xob + (vb*tb) + ((1/2)*a*tb*tb);
- printf("La posicion final es: %lf \n", xfb);
- break;
- case 'C':
- printf("Ingrese altura inicial y tiempo: \n");
- scanf("%lf %lf",&h, &tc);
- y = h - ((1/2)*G*tc*tc);
- printf("La posicion final es: %lf \n", y);
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement