Skip to content

Instantly share code, notes, and snippets.

@mokomokohitsuzi
Created October 18, 2016 13:35
Show Gist options
  • Save mokomokohitsuzi/98c2dad6b333079ec693e364e0f7c46e to your computer and use it in GitHub Desktop.
Save mokomokohitsuzi/98c2dad6b333079ec693e364e0f7c46e to your computer and use it in GitHub Desktop.
新・明解Java入門 演習3-9
import java.util.Scanner;
public class En3_9 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.print("実数値A:");
double a = stdIn.nextDouble();
System.out.print("実数値B:");
double b = stdIn.nextDouble();
// 三項演算子で結果を表示。
System.out.println("大きい方の値は" + (a > b ? a : b) + "です。");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment