0

这是我到目前为止得到的。我也不知道如何显示最小和最大以及偶数和奇数输入来显示。有人请帮忙

整数值 = -1;

    Scanner scanner = new Scanner(System.in);

    while(value < 0) 
    {
      System.out.print("Enter a value > 0: ");

      value = scanner.nextInt();

    }
      if(value < 0)

      System.out.println("sorry write a value > 0");

    }
4

1 回答 1

0

这有帮助吗?

导入 java.util.Scanner;

公共类主要{

public static void main(String[] args) {

    Scanner value = new Scanner(System.in);

    int number =value.nextInt();

    if (number < 0 ) {
        System.out.println("Value entered less than zero");
    }
    else if (number == 0) {
        System.out.println("Value entered is equal to zero");
    } else {
        System.out.println("Value must have been greater than zero.");
    }
}

}

于 2013-11-04T16:57:54.787 回答