Using (PHP) code to solve problems.
Multiples of 3 and 5
If we list all the natural numbers from 0 – 40 that are multiples of 3 and 5, we get 15 and 30 only.
The sum of these multiples is 45.
Find the sum of all the multiples of 3 and 5 from 0 – 1000.
The solution to the Problem 2 described above is shown in Figures 1, 2 and 3. The code was written using PHP. Figure 1 shows the first page of the code, Figure 2 shows the second page of the code and Figure 3 shows the code output. The whole code runs in less than 1 second.
Do you have any questions? Feel free to drop your comments below. I will respond.