判断三个数中的中间数

package com.astar.cop.dao;

import java.util.Scanner;

public class test {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int m, n, k;
m = (a > b ? b : a);
if (a > b)
m = b;
else
m = a;
if (m > c)
k = m;
else {
n = (a > b ? a : b);
if (n > c)
k = c;
else
k = n;
}
System.out.println(k);
}
}

你可能感兴趣的:(java)