Monday, September 8, 2014

Software Engineer or good Googler?



Some times you wonder am I actually good at this software development stuff or am I just good at googling for the solution to the latest roadblock I have encountered.  As part of this blog I am going to start trying to solve randomly encountered coding challenges and blog the question and answer here.  I will not be looking for the most efficient or elegant solution just the solution.  Maybe other software engineers like my wife and friends will be kind enough to review the solutions for me.


For a quick and easy problem I did one from http://projecteuler.net



https://projecteuler.net/problem=1

Find the sum of all the multiples of 3 or 5 below 1000.


int sum = 0;

for (int i = 1; i < 1000; i++) {
    if ( i % 5 == 0 || i % 3 == 0) {
        sum += i;
    }    
}
System.out.println(sum);




No comments:

Post a Comment