解题思路:
先转换字符串,之后使用remainder方法求余
注意事项:
参考代码:
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
scanner = new Scanner(System.in);
double x = scanner.nextDouble();
double y = scanner.nextDouble();
BigDecimal xTwo = new BigDecimal(Double.toString(x));
BigDecimal yTwo = new BigDecimal(Double.toString(y));
BigDecimal n = xTwo.remainder(yTwo);
System.out.println(n);
}
}
0.0分
1 人评分