Generation

generate functionWed, 02 Aug 2023

function to find the smallest common multiple between two numbers

function smallestCommons(arr) { var max = Math.max(arr[0], arr[1]); var min = Math.min(arr[0], arr[1]); var multiple = max; for (var i = max - 1; i >= min; i--) { if (multiple % i) { multiple += max; i = max; } } return multiple; }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant