It is necessary to calculate and display the factorial of the number specified on the command line. Handle possible user input errors with try, catch, and throw. I only managed to find factor numbers without try, catch and throw operators:
public class Test { public static void main(String args[]) { int n; do { Scanner scan = new Scanner(System.in); System.out.print("Введите факториал натурально числа n : "); n = scan.nextInt(); int result = 1; for (int i = 2; i <= n; i++) result *= i; System.out.println(result); if (n == 0 || n == 1) System.out.println(result); if(n < 0) System.out.println("Вы ввели отрицательный факториал!"); } while (n < 0);{System.out.println("Конец");} } } Waiting for help!