I’ve been learning JavaScript at Code Academy. I wrote the following bit of code to find all prime numbers from 1 to 100:
for (x = 3; x <=100; x = x +1)
{
var a = 0
var z = 0
for (y =2; y <= x – 1; y = y + 1)
{
z = x % y
if (z === 0) {a = a + 1} else {}
}
if (a === 0) {console.log(x)} else {}
Thursday, August 23, 2012
Saturday, March 24, 2012
Back in action
After many months of inactivity, I have returned to Spadinasaur, this time testing Microsoft’s Windows Live Writer. More later.
Subscribe to:
Posts (Atom)