stephan23

Project Euler - problem 1

Jun 1st, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.17 KB | None | 0 0
  1. <?php
  2.     // My answer to http://projecteuler.net/problem=1  
  3.     $tot = 0;
  4.    
  5.     for ($i=0; $i<1000; $i++) {
  6.         if ($i%3==0 || $i%5==0) {
  7.             $tot +=$i;
  8.         }
  9.     }
  10.    
  11.     echo $tot;
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment