Last active
October 18, 2016 14:17
-
-
Save mokomokohitsuzi/06b497e5554c7339029603a4896a7d8e to your computer and use it in GitHub Desktop.
新・明解Java入門 演習3-10
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 En3_10 { | |
public static void main(String[] args) { | |
Scanner stdIn = new Scanner(System.in); | |
System.out.print("整数値A:"); | |
int a = stdIn.nextInt(); | |
System.out.print("整数値B:"); | |
int b = stdIn.nextInt(); | |
// 三項演算子で結果を表示。 | |
System.out.println("2つの整数値の差は" + (a > b ? (a - b) : (b - a)) + "です。"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment