More progress
This commit is contained in:
21
solutions/other/sumdiv20.php
Normal file
21
solutions/other/sumdiv20.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
//Write a function to find the smallest number that is divisible by each of the numbers from 1 to 20.
|
||||
|
||||
function sumdiv20() {
|
||||
$i = 20;
|
||||
while(true) {
|
||||
$i += 20;
|
||||
|
||||
if($i %19== 0) {
|
||||
if($i %18== 0) {
|
||||
if($i %17== 0) {
|
||||
if($i %16== 0) {
|
||||
if($i %15== 0) {
|
||||
if($i %14== 0) {
|
||||
if($i %13== 0) {
|
||||
if($i %12== 0) {
|
||||
if($i %11== 0) {
|
||||
return $i;
|
||||
}}}}}}}}}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user