10. 读入后做运算

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

语法讲解

今天学: 读入的数据可以参与运算。

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        System.out.println(x * 2);
    }
}

小练习

如果输入 7,输出是什么?

输入: 7

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

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

                        
👩‍🏫
AI
💬 题目评论

全部评论