Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('input ?!')
- n = int(input())
- print('input number of items')
- m = int(input())
- i = 0
- j = n - m
- factorial_n = 1
- while i < n:
- i += 1
- factorial_n = factorial_n * i
- factorial_j = 1
- while i < j:
- i += 1
- factorial_j = factorial_j * i
- factorial_m = 1
- while i < m:
- i += 1
- factorial_m = factorial_m * i
- combination_m = factorial_n / (factorial_j * factorial_m)
- result = 'factorial ' + str(n) + ' = ' + str(factorial_n) + '\n' + 'combination ' + str(m) + ' = ' + str(combination_m)
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement