整合所有的代码,并测试了一些数据

master
Dongboo 4 years ago
parent ef36211b86
commit 73e8136416

@ -0,0 +1,38 @@
package test;
import java.util.Scanner;
public class Main {
static double a,b;
public static double add (double a,double b) {//źÓˇ¨
return a+b;
}
public static double sub (double a,double b) {//źőˇ¨
return a-b;
}
public static double mult(double a,double b) {//łË
return a*b;
}
public static double div(double a,double b) {//łý
return a/b;
}
public static double power(double a,double b) {//ĂÝ
return Math.pow(a,b);
}
public static double sqrt(double a) {//żŞˇ˝
return Math.sqrt(a);
}
public static double log(double a) {
return Math.log(a);
}
public static void main(String[] args) {
Scanner sc = new Scanner( System.in );
a=sc.nextInt();
b=sc.nextInt();
System.out.println(add(a,b)+" "+sub(a,b)+" "+mult(a,b)+" "+div(a,b)+" "+power(a,b)+" "+sqrt(a)+" "+log(a));
}
}
Loading…
Cancel
Save