Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. print('input ?!')
  2. n = int(input())
  3. print('input number of items')
  4. m = int(input())
  5. i = 0
  6. j = n - m
  7. factorial_n = 1
  8. while i < n:
  9. i += 1
  10. factorial_n = factorial_n * i
  11. factorial_j = 1
  12. while i < j:
  13. i += 1
  14. factorial_j = factorial_j * i
  15. factorial_m = 1
  16. while i < m:
  17. i += 1
  18. factorial_m = factorial_m * i
  19. combination_m = factorial_n / (factorial_j * factorial_m)
  20. result = 'factorial ' + str(n) + ' = ' + str(factorial_n) + '\n' + 'combination ' + str(m) + ' = ' + str(combination_m)
  21. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement