fork download
  1. class Logaritmos {
  2.  
  3. public static void main(String[] args) {
  4. System.out.println(log(2, 128));
  5. System.out.println(log(5, 625));
  6. System.out.println(log(100, 1000));
  7. System.out.println(log(7, 49));
  8. }
  9.  
  10. public static double log(double base, double valor) {
  11. return Math.log(valor) / Math.log(base);
  12. }
  13. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
7.0
4.0
1.4999999999999998
2.0