Created
October 11, 2016 11:44
-
-
Save mokomokohitsuzi/4a4d40d2e89e4047870254931986f674 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習3-4
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_4 { | |
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(); | |
//aとbを比べ、条件によって分岐する。 | |
if (a > b) { | |
System.out.println("aのほうが大きいです。"); | |
} else if (b > a) { | |
System.out.println("bのほうが大きいです。"); | |
} else { | |
System.out.println("aとbは同じ値です。"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment