Last active
October 19, 2016 13:02
-
-
Save mokomokohitsuzi/b7a6089e6e14a4ed8ccca12c5d56c639 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習3-11
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_11 { | |
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(); | |
// 差を求める 差が10以下である場合、それ以上の場合。 | |
int sa = (a > b ? a - b : b - a); | |
System.out.println("それらの差は10" + (sa <= 10 ? "以下" : "以上") + "です。"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment