Last active
October 4, 2016 11:33
-
-
Save mokomokohitsuzi/4b0a7471f2d16c7cc2541abed52320bb to your computer and use it in GitHub Desktop.
新・明解Java入門 演習2-5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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