0

this is code to find sum of all.prime below 2 million...i get a segmentation fault(core dumped)...please correct code

answer is 142913828922 code: https://code.sololearn.com/cLqaNpcZIq6O/?ref=app

8th Jul 2018, 7:18 AM
Dhanaraj S
Dhanaraj S - avatar
10 Respostas
0
ben allen... that is not necessary buddy
8th Jul 2018, 2:43 PM
Dhanaraj S
Dhanaraj S - avatar
+ 4
Yes visualmedia ytb , please
9th Jul 2018, 10:27 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
you can't store the answer in long int You might in long long unsigned though
8th Jul 2018, 7:48 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
This code is hard to understand. Would you mind adding comments.
8th Jul 2018, 7:56 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 3
visualmedia ytb can you show us the final version please ? I am a bit curious
8th Jul 2018, 2:47 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
For starters, return type void isn't valid for main. It has to return 0
8th Jul 2018, 2:26 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
In know it's not sufficient. It was just the first issue I saw. I looked at your code for 30-45 minutes trying to solve it but it's hard to understand what's going on. Please clean up and comment your code.
8th Jul 2018, 2:46 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
ben allen i just wanna find sum of all primes below 2 million... that was my task... i just modified my code ... it works... do you wanna see the modified one!??
9th Jul 2018, 9:57 AM
Dhanaraj S
Dhanaraj S - avatar
0
thanks everyone i modified my code... it works pretty well now...
8th Jul 2018, 2:43 PM
Dhanaraj S
Dhanaraj S - avatar