1、java:
1 import java.util.*; 2 import java.math.*; 3 public class Main { 4 public static void main(String args[]){ 5 Scanner cin = new Scanner(System.in); 6 BigInteger a,b; 7 8 while(cin.hasNext()){ 9 a=cin.nextBigInteger(); 10 b=cin.nextBigInteger(); 11 //四则运算 12 System.out.println(a.add(b));//加 13 System.out.println(a.subtract(b));//减 14 System.out.println(a.multiply(b));//乘 15 System.out.println(a.divide(b));//除 16 System.out.println(a.remainder(b));//取模 17 //比较 18 if(a.compareTo(b)==0) System.out.println("a==b"); 19 else if(a.compareTo(b)>0) System.out.println("a>b"); 20 else if(a.compareTo(b)<0) System.out.println("a<b"); 21 //十进制表示 22 System.out.println(a.toString()); 23 //返回大整数p进制的制服表示 24 int p=8; 25 System.out.println(a.toString(p)); 26 } 27 } 28 }