Project Euler

So I was looking around for some programming information and found Project Euler. They have a number of problems to program. You can choose any programming language, it’s just to enhance your programming abilities.

So here is the answer to problem number one.

#!/usr/bin/perl

use warnings;
use strict;

my $sum;
my $count;

for ($count = 0; $count < 1000; $count ++) {
        if (($count % 3 == 0) || ($count % 5 == 0)) {
                $sum = $count + $sum;
                print "\$sum is $sum\n"; }
        }

It’s a really simple exercise. You just need to sum of all the multiples of 3 or 5 below 1000.

Leave a Reply