Mar-25-2020, 04:31 AM
The test for multiples is odd. Multiples of 15 will be 15, 30, 45, 60, …. There is no reason for me to test 1, 2, ...14, 15 etc. Reversing your logic to generate multiples and stop when the multiple is out of range would be a lot more efficient.
But that is not what you are asking. I'm not exactly sure what you are asking. Do you want the multiples printed out or not? Or do you want to return the multiples, say in a list, instead of printing them out? Do you want the program to return [15, 30, 45, 60] instead of 4?
But that is not what you are asking. I'm not exactly sure what you are asking. Do you want the multiples printed out or not? Or do you want to return the multiples, say in a list, instead of printing them out? Do you want the program to return [15, 30, 45, 60] instead of 4?