使用 Java 将一个 BigInteger 从另一个 BigInteger 中进行除法运算
使用 Java 中的 BigInteger divide() 方法将一个 BigInteger 从另一个 BigInteger 中进行除法运算。
首先,让我们创建一些对象。
BigInteger one, two, three;
one = new BigInteger("200");
two = new BigInteger("100");对以上进行除法计算并赋值到第三个对象 −
three = one.divide(two);
以下是一个示例 −
示例
import java.math.*;
public class BigIntegerDemo {
public static void main(String[] args) {
BigInteger one, two, three;
one = new BigInteger("200");
two = new BigInteger("100");
// division
three = one.divide(two);
String res = one + " / " + two + " = " +three;
System.out.println("Result: " +res);
}
}输出
Result: 200 / 100 = 2
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP