This article shared the Java algorithm computing level multiplier. When learning the Java course, I often encounter the problem of order. Today I will discuss with you
The code is as follows:
package com.xu.main; Import java.util.scanner; Public Class P9 {Static Long Fact (int N) {if (n <= 1) {Return 1;} Else {Return N * Fact (n -1); } } public static void main(String[] args) { int i; System.out.println("请输入要求阶乘的一个整数:"); Scanner input = new Scanner(System.in); i = input.nextInt (); System.out.println (i + "order results are:" + fact (i));}}Run results: