import java.math.BigInteger; import java.util.Scanner; public class CalculateN { /** * @param args */ public static void main(String[] args) { System.out.print("������N��"); Scanner scanner=new Scanner(System.in); int number=scanner.nextInt(); System.out.println(number+"!="+calculateN2(number)); } public static long calculateN(int n) { if(n==1 || n==0){ return 1; } return n*calculateN(n-1); } public static BigInteger calculateN2(int n) { if(n==1 || n==0){ return BigInteger.valueOf(1); } return BigInteger.valueOf(n).multiply(calculateN2((n-1))); } }
public class CompareFloatNumber { /** * @param args */ public static void main(String[] args) { //compare(); compare2(); } private static void compare() { double i = 0.0001; double j = 0.00010000000000000001; System.out.println(i==j); //�����true } private static void compare2() { double i = 0.0001; double j = 0.00010000000000000001; if(Math.abs(i-j)<1e-10){ System.out.println("true"); } else { System.out.println("false"); } } }
标签:args,return,void,动脑,System,动手,static,public From: https://www.cnblogs.com/xuan-2004/p/17722972.html