Using (PHP) code to solve problems.
Multiples of 3 or 5
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
The solution to the Problem 1 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 leave your comments below. I will respond.