java数组

    xiaoxiao2021-03-25  116

    C语言实验——找中间数

    Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic

    Problem Description

    输入三个整数,找出其中的中间数。(这里的中间数指的是大小,不是位置。)

    Input

    输入3个整数。

    Output

    输出中间数。

    Example Input

    1 2 3

    Example Output

    2

    Hint

    import java.util.*; import java.math.*; import java.util.*; public class Main2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int a[] = new int[4]; a[1] = input.nextInt(); a[2] = input.nextInt(); a[3] = input.nextInt(); Arrays.sort(a);//下标从1开始 System.out.println(a[2]); } }
    转载请注明原文地址: https://ju.6miu.com/read-22877.html

    最新回复(0)