-
-
Save XdarksyderX/eaffb250394b69ab384eac7a64480849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
void pasarDeEurosADolares() | |
{ | |
char eleccion; | |
int cantidad; | |
float cambio = 0.9; | |
while (1) | |
{ | |
printf("Ingrese d para pasar de euros a dolares o e para pasar de dolares a euros: "); | |
scanf("%c", &eleccion); | |
if(eleccion == 'd' || eleccion == 'D') | |
{ | |
printf("Ingrese la cantidad a cambiar: "); | |
scanf("%i", &cantidad); | |
printf("El resultado es %f dolares", cantidad / cambio); | |
break; | |
} | |
else if (eleccion == 'e' || eleccion == 'E') | |
{ | |
printf("Ingrese la cantidad a cambiar: "); | |
scanf("%i", &cantidad); | |
printf("El resultado es %f euros", cantidad * cambio); | |
break; | |
} | |
else | |
{ | |
printf("Eleccion erronea\n"); | |
} | |
} | |
} | |
int main() | |
{ | |
pasarDeEurosADolares(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment