You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package calculator;
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
public class log {
|
|
|
|
|
|
|
|
|
|
public log() {
|
|
|
|
|
Scanner sc = new Scanner(System.in);
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>a");
|
|
|
|
|
double a = sc.nextDouble();
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x");
|
|
|
|
|
double x = sc.nextDouble();
|
|
|
|
|
if(x>0&&a>0&&a!=1)
|
|
|
|
|
{
|
|
|
|
|
double result = log(a,x);
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD>Ϊ:"+result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
System.out.println("errors ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static double log(double a, double x){
|
|
|
|
|
return Math.log(x) / Math.log(a);
|
|
|
|
|
}
|
|
|
|
|
}
|