Skip to content

Instantly share code, notes, and snippets.

@mokomokohitsuzi
Last active October 2, 2016 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mokomokohitsuzi/25fe7cd07e7687e6c37e971a19da98f7 to your computer and use it in GitHub Desktop.
Save mokomokohitsuzi/25fe7cd07e7687e6c37e971a19da98f7 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習2-4
//スキャナーのimport文を設定。
import java.util.Scanner;
public class En2_4 {
public static void main(String[] args) {
// スキャナー変数を宣言。
Scanner stdIn = new Scanner(System.in);
System.out.print("整数値:");
// 変数seisuに整数値を読み込む。
int seisu = stdIn.nextInt();
// 結果を出力
System.out.println("10を加えた値は" + (seisu + 10) + "です。");
System.out.println("10を減じた値は" + (seisu - 10) + "です。");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment