m={1,2,3,4,5,6,7,8,9,10.9}//不確定個數的double集合。n為不確定個數的整數.在集合m中選取n個元素組合相乘得到list的乘積集合list<double> list(list<double> m,int n){}例如m集合元素為{1.0,2.0,3.0,4.0},n為3的話。返回的結果應該是list={6.0,8.0,12.0,24.0}
1 回答
夢里花落0921
TA貢獻1772條經驗 獲得超6個贊
public List<double> MyList(List<double> m, int n){ var y = from x in m select Math.Pow(x, n); return y.ToList();} |
- 1 回答
- 0 關注
- 162 瀏覽
添加回答
舉報
0/150
提交
取消
