Advertisement
Spocoman

Combinations

Jan 5th, 2022 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. n = int(input())
  2. combinations = 0
  3.  
  4. for a in range(0, n + 1):
  5.     for b in range(0, n + 1):
  6.         for c in range(0, n + 1):
  7.             if a + b + c == n:
  8.                 combinations += 1
  9.  
  10. print(combinations)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement