Guest User

Untitled

a guest
Mar 18th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. from math import factorial
  2.  
  3.  
  4. def combinatoria(n, k):
  5. return factorial(n) // factorial(k) * factorial(n - k)
  6.  
  7.  
  8. a = input("Digite el valor de a:")
  9. b = input("Digite el valor de b:")
  10. while (not (a.isdigit() and b.isdigit)):
  11. print("a y b deben ser valores numericos")
  12. a = input("Digite el valor de a:")
  13. b = input("Digite el valor de b:")
  14. if (a > b):
  15. print("a debe ser menor que b, por lo tanto a será ", b, "y b será ", a)
  16. temp = a
  17. a = b
  18. b = temp
  19.  
  20. a = int(a)
  21. b = int(b)
  22. print(combinatoria(a, b))
Add Comment
Please, Sign In to add comment