Sum of all prime
The problem was challenging and it was a bit tricky and the moment I saw the problem I thought of a for-loop and I did use it but I got stuck along the way.
Problem
Sum all the prime numbers up to and including the provided number. A prime number is defined as a number greater than one and having only two divisors, one and itself. For example, 2 is a prime number because it’s only divisible by one and two.
Approach
I first used a for-loop and got stuck along the way, I then asked for help from my pears.
final Approach
I have the first function and the function had a for-loop which checked if the passed in numbers are prime numbers or not.
I had another function with a for-loop takes the numbers which are prime numbers and adds as a new array of prime numbers.
Conclusion
As I mentioned above that it was absolutely not an easy task for me to complete but at the end I managed to get it right and get it working