Skip to content

Instantly share code, notes, and snippets.

@mokomokohitsuzi
Last active October 4, 2016 11:33
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/4b0a7471f2d16c7cc2541abed52320bb to your computer and use it in GitHub Desktop.
Save mokomokohitsuzi/4b0a7471f2d16c7cc2541abed52320bb to your computer and use it in GitHub Desktop.
新・明解Java入門 演習2-5
import java.util.Scanner;
public class En2_5 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.print("xの値:");
// 実数値で読み込み
double x = stdIn.nextDouble();
System.out.print("yの値:");
double y = stdIn.nextDouble();
// 結果を出力
System.out.println("合計は" + (x + y) + "です。");
System.out.println("平均は" + (x + y) / 2 + "です。");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment