What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-01-31 12:00:11
sum of prime numbers javascript
function sumPrimes(num) { let i = 1; let sum = 0; while (i <= num) { if (isPrime(i)) { sum += i; } i++; } return sum; } //function to check if a number is prime or not function isPrime(x) { for (let i = 2; i < x; i++) {... Add solution -
CSS 2021-11-20 03:20:25
sieve of eratosthenes
// C++ program to print all primes smaller than or equal to // n using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(int n) { // Create a boolean array "prime[0..n]" and initialize /... Add solution