Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created December 30, 2019 01:35
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/360428d525388c5abb737213d1137074 to your computer and use it in GitHub Desktop.
Save parzibyte/360428d525388c5abb737213d1137074 to your computer and use it in GitHub Desktop.
/*
* Archivo: RaizCuadradaCubica.java
* Clase: RaizCuadradaCubica
* Autor: parzibyte
* Fecha: 12/29/19 7:13 PM
* Visita https://parzibyte.me/blog para más tutoriales sobre Java
*/
public class RaizCuadradaCubica {
public static void main(String[] args) {
double numero = 25;
double raizCuadrada = Math.sqrt(numero);
System.out.printf("Raíz cuadrada de %.2f es %.2f\n", numero, raizCuadrada);
double otroNumero = 125;
double raizCubica = Math.cbrt(otroNumero);
System.out.printf("Raíz cúbica de %.2f es %.2f\n", otroNumero, raizCubica);
double miNumero = 125;
double raizCubicaConCbr = Math.pow(miNumero, (double) 1 / 3);
System.out.printf("Raíz cúbica de %.2f es %.2f\n", miNumero, raizCubicaConCbr);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment