Aaron Dale, Web Developer

Projects - Feedback - Code

Lotto Number Generator

This code generators all the lotto combinations for WA State 6-49 lotto.

//22 37 41 47 48 49 $tcount = 0; for($a = 22; $a <= 49; $a++) { for($b = 23; $b <= 49; $b++) { for($c = 24; $c <= 49; $c++){ for($d = 25; $d <= 49; $d++){ for($e = 26; $e <= 49; $e++){ for($f = 27; $f <= 49; $f++){ if(($a != $b) && ($a < $b) && ($b != $c) && ($b < $c) && ($c != $d) && ($c < $d) && ($d != $e) && ($d < $e) && ($e != $f) && ($e < $f) ) { $tcount++; $fp = fopen('649.txt', 'a'); fwrite($fp, $a . ' ' . $b . ' ' . $c . ' ' . $d . ' ' . $e . ' ' . $f . chr(13) . chr(10)); fclose($fp); } } } } } } } echo 'Total count is: ' . $tcount;

Portfolio - Feedback - Code