10. 读入后做运算
语法讲解
今天学: 读入的数据可以参与运算。
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
提交要求: 只提交最终输出结果,不要添加多余的说明或引号。
全部评论