From cd9a83fc917d14bde902a05dd05fc4b7a0298ac0 Mon Sep 17 00:00:00 2001 From: goksunonal <32015340+goksunonal@users.noreply.github.com> Date: Tue, 30 Oct 2018 21:10:41 +0300 Subject: [PATCH] Creating SumOfPrimes For Java --- 010/SumOfPrimes.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 010/SumOfPrimes.java diff --git a/010/SumOfPrimes.java b/010/SumOfPrimes.java new file mode 100644 index 0000000..6099ffd --- /dev/null +++ b/010/SumOfPrimes.java @@ -0,0 +1,25 @@ +import java.math.*; +public class SumOfPrimes { + public static boolean isPrime(long number) { + long sqr=(long)Math.sqrt(number); + for(long i=2;i<=sqr;i++) { + if (number%i==0) { + return false; + } + + } + return true; + } + public static void main(String[] args) { + long limit=2000000; + long sum=0; + for(long i=2;i