View Single Post
Old 07-15-2013, 02:30 PM   #240
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 33
Posts: 6,205
Default Re: The Project Euler thread

I'm currently on my lunch break, so I decided that instead of studying for my ethernet and osi model exam tomorrow, I'd delve into powershell.

Had a bit of an issue getting custom scripts to work without having digital signatures, but oh well.


Code:
$count = 0
$total = 0
do{if (($count % 3 -eq 0) -or ($count % 5 -eq 0))
  {
  $total = $total + $count
  }
  else
  {
  $total = $total
  }
$count++
}
while ($count -lt 1000)
echo $total


this feels very reminiscent of java and maybe you DuDeZ will stop hating me because I'm not using BASIC

maybe ???


edit: problem two solved, I was originally incrementing my variables one number at a time but I quickly realized that this would need a variable for every number in the sequence lol


Code:
$f0 = 0
$f1 = 1
$fsum = 0
do{
  if ($f1 % 2 -eq 0)
  {
    $fsum = $fsum + $f1
  }
  if ($f0 % 2 -eq 0)
  {
    $fsum = $fsum + $f0
  }
  $f0 = $f0 + $f1
  $f1 = $f1 + $f0
  }
while ($f0 -lt 4000000)
echo $fsum
__________________

Last edited by Choofers; 07-15-2013 at 03:19 PM..
Choofers is offline   Reply With Quote