I'm trying to do this question
Code:
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.
This is the approach I'm trying to take.
1. create an array from 1 to 10 and display
2. divide each number in the array by 3 and 5
3. sum up all the numbers which when divided by 3 and 5 gives a remainder of 0
I'm having difficulty with step 1. I would like to automatically populate the array from numbers 1 to 10 instead of saying
Code:
int numbers[]={1,2,3,..}.
Is this possible?