Java 2个(多个)大整数相加如何实

倚天杖
浏览 878回答 2
2回答

largeQ

import java.util.Scanner;public class Add{  public static void mian(String[] args) {     System.out.println("请输入被加数a:"); Scanner scanner1 = new Scanner(System.in); int num1 = scanner1.nextInt(); System.out.println("请输入被加数b"); Scanner scanner2 = new Scanner(System.in); int num2 = scanner2.nextInt(); int sum = add(num1,num2); System.out.println("a + b = " + sum); } static int add(int a, int b) { return a+b; }}

红颜莎娜

说啥?
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java