12. 读入三个整数

👁️ 6 人浏览 💬 0 人评论 ❤️ 添加收藏

语法讲解

今天学: 同理可以读入三个或更多个值。

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        System.out.println(a + b + c);
    }
}

小练习

如果输入 10 20 30,输出是什么?

输入: 10 20 30

提交要求: 只提交最终输出结果,不要添加多余的说明或引号。

提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论