Posted on September 3rd, 2010 by christyjohn
Category: Project Euler, Tags: Project Euler, Project Euler Java, Project Euler Problem 2
[NB: This series is here for my own reference. It is not meant as a help for others who are trying to solve problems at Project Euler. Please don't use it so because it will foil the purpose and also I don't guarantee the quality of the answers.]
Java
public class Euler2
{
public static void main(String[] args)
{
int sum = 0;
int i = 0;
int k = 1;
for(int fib = 0; fib < 4000000; fib = i + k)
{
i = k;
k = fib;
if(fib % 2 == 0)
sum += fib;
}
System.out.println("The result is: " + sum);
}
}
Posted on September 3rd, 2010 by christyjohn
Category: Project Euler, Tags: Project Euler Problem 1
[NB: This series is here for my own reference. It is not meant as a help for others who are trying to solve problems at Project Euler. Please don't use it so because it will foil the purpose and also I don't guarantee the quality of the answers.]
Java
public class Euler1
{
public static void main(String[] args)
{
int sum = 0;
for (int i = 1; i < 1000; i++)
{
if(i % 3 == 0 || i % 5 == 0)
{
sum += i;
}
}
System.out.println("The sum is :" + sum);
}
}
Posted on September 1st, 2010 by christyjohn
Category: Uncategorized
Today I’m embarking on a new journey. I’m starting a software engineering blog. For many years I have been reading and learning from many of the top post from the blogosphere. So I thought It is time that I reciprocate the process. Thus here it is. My foray into the world of programming blogs.
You may understand the general idea behind the blog by going through the ‘About‘ page.
So once again welcome.