我想創建一個將多種向量R. vec1<-c("a", "b")
vec2<-seq(2,4)
vec3<-c("x", "y")
它應該是這樣的一個表: vec1 vec2 vec3
a 2 x
a 2 y
a 3 x
a 3 y
a 4 x
a 4 y
b 2 x
b 2 y
b 3 x
b 3 y
b 4 x
b 4 y
我試圖用outer。當我有兩個向量時
以下是代碼。你可以自己測試它。 請解釋一下:) var factorial = 1;
function factorialize(num) {
factorial *= num;
if (num == 1) {
var result = factorial;
return result;
}
factorialize(num-1
我想在C#中創建一個階乘計算器,但是我在將它們收集到一個列表中後,遇到了所有數字的乘積問題。 List<int> myList = new List<int>();
Console.WriteLine("My Job is to take the factorial of the number you give");
Console.WriteLine("What is
我的代碼對數字進行了階乘運算,但由於某種原因,每當我輸入數字13或更高時,它會給出錯誤的數字或者以某種方式得到負數。有什麼建議麼? List<int> myList = new List<int>();
Console.WriteLine("My Job is to take the factorial of the number you give");
Console.
我是Java新手。我做了這個程序,找出一個數的階乘。結果是正確的,但它打印多次。例如如果我們輸入一個數字4作爲輸入。 「4的24位」是在控制檯上打印5次。請清除此程序的流程。由於在輸出最終結果之前使用遞歸方法「factor」,爲什麼它會在控制檯上多次出現? public class Fact {
int number;
int LocalNumber;
void m(){