Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created December 25, 2013 15:32
Show Gist options
  • Save shigemk2/8124244 to your computer and use it in GitHub Desktop.
Save shigemk2/8124244 to your computer and use it in GitHub Desktop.
あるごりずむのやつ
import java.util.Scanner;
class Max3 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in); // 標準入力ストリーム
System.out.println("三つの整数の最大値を求めます");
System.out.println("aの値: ");
int a = stdIn.nextInt(); // 入力
System.out.println("bの値: ");
int b = stdIn.nextInt();
System.out.println("cの値: ");
int c = stdIn.nextInt();
int max = a;
if (b > max) max = b;
if (c > max) max = c;
System.out.println("最大値は" + max + "です");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment