Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function combinations(input) {
- let num = parseInt(input[0]);
- let counter = 0;
- for (let a = 0; a <= num; a++) {
- for (let b = 0; b <= num; b++) {
- for (let c = 0; c <= num; c++) {
- if (a + b + c === num){
- counter++;
- }
- }
- }
- }
- console.log(counter);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement