jsは2つの数の最小公倍数を書きます.

4212 ワード

<!DOCTYPE html>
<html leng = 'en'>
 	<head>
  		<meta charset = 'UTF-8'/>
	 </head>
	 <body>
	  	<script>
			var num1 = parseInt(prompt('               '));
			var num2 = parseInt(prompt('               '));
			function test(num1, num2){
     
				var rem = num1 % num2;
				if(rem === 0){
     
					
					return num2;
				}
				num1 = num2;
				num2 = rem;
				return test(num1, num2);
			}
			var least = num1 * num2 / test(num1, num2);
			console.log(least + '           ');
  		</script>
 	</body>
</html>