Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 25, 2020 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/13ae75721bf439b08e1b71e0b77869d8 to your computer and use it in GitHub Desktop.
Save parzibyte/13ae75721bf439b08e1b71e0b77869d8 to your computer and use it in GitHub Desktop.
// Para leer datos por teclado
Scanner sc = new Scanner(System.in);
// Aquí vamos a almacenar las variables
double equivalencia,
cantidadDolares;
// Solicitar datos
System.out.println("Ingresa el valor del dólar en pesos: ");
equivalencia = sc.nextDouble();
System.out.println("Ingresa la cantidad de dólares: ");
cantidadDolares = sc.nextDouble();
// Hacer conversión
double pesos = cantidadDolares * equivalencia;
// Imprimir resultados
System.out.printf("%f dólares equivalen a %f pesos\n", cantidadDolares, pesos);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment