Apple launches iPad

Few years back, the Apple revolutionized the mobile phone market with their iPhone. Lets see if they can do the same in the tablet computers segment.
Labels: Apple, Apple iPad
|
Home | | | Techie Talk | | | Story Time | | | About | | | Contact |
Labels: Apple, Apple iPad
Labels: automobile, Chevrolet Beat
Labels: AICTE, Deemed University
Labels: aayirathil oruvan, Movie Review
Labels: aayirathil oruvan trailer, ayirathil oruvan, tamil_blog, ஆயிரத்தில் ஒருவன்
To write an algorithm with the minimum no. of executions to calculate the Sum of all natural numbers from 1 to N, that are divisible by 4 or 7 ?Though the question looked very simple, it was really exciting to find the solution. Here is the pseudo code of what we think as a good solution :
I know there are many other smart solutions for this problem. If you, have one share it in the comments section.
- Initialize a=0, b=0, c=0, result=0
- Run a loop for i = 1 to (N/28)
- a = a + i
- Next value of i
- Run a loop for i = (N/28)+1 to (N/7)
- b = b + i
- Next value of i
- Run a loop for i = (N/7)+1 to (N/4)
- c = c + i
- Next value of i
- result = (4*(a+b+c)) + (7*(a+b)) - (28*a)
Labels: computer programming, programming puzzles
Labels: Australia Pakistan Test series, Cricket
Labels: chennai book fair 2010, tamil_blog, புத்தகக் கண்காட்சி