Code tính tổ hợp trong C#
public double GiaiThua(int n) { double giaithua = 1; for (int i = 2; i <= n; i++) giaithua *= i; return giaithua; } public double ToHop(int k, int n) { return GiaiThua(n) / (GiaiThua(k) * GiaiThua(n – k)); } Nosomovo
public double GiaiThua(int n) { double giaithua = 1; for (int i = 2; i <= n; i++) giaithua *= i; return giaithua; } public double ToHop(int k, int n) { return GiaiThua(n) / (GiaiThua(k) * GiaiThua(n – k)); } Nosomovo
Bản quyền © 2024 | Theme WordPress viết bởi MH Themes