Java recursive

markdown #說明 這篇是Java 簡易遞迴運算 #操作流程 ##code ``` package recursuve; import java.io.*; class Computer{ int recursive(int x) { if (x<1) { return 1; } else { return x*recursive(x-1); } } } public class recursive { public static void main (String[] argv )throws IOException{ Computer a= new Computer(); System.out.print("please input x\n->"); BufferedReader br =new BufferedReader(new InputStreamReader (System.in)); int x= java.lang.Integer.parseInt(br.readLine()); System.out.println("X! = " +a.recursive(x)); } } ``` ##Demo
code

留言