递归问题?

use*_*868 1 java recursion

所以这是我的第一个递归函数(我希望!)而且我不确定为什么它不起作用(又名红线)任何想法?

int myFactorial(int C) { //underlined, expects ";"

    int n = Integer.parseInt(objectsChooseField.getText());
    int r = Integer.parseInt(chooseFromField.getText());

    if (C == 1){
        return 1; //underlined, cannot return value from method whose result type is void
    }
    return (C*(myFactorial(n/(r(n-r))))); //underlined
}
Run Code Online (Sandbox Code Playgroud)

zw3*_*324 10

在这里:r(n-r).

r不是函数,而是局部变量int.

你的意思是r * (n - r)