Follow

euler.stephan-brumme.com/50/
this is what i have been working on for school
i need to get the primesum of 10
and still testing for primpt
`
///anme
<iostream>
<cctype>
using namespace std;
int main()
{
char Stop = 'n';
int maxRange = 0;
int primeSum = 0;
do
{
cout << "enter a number for the max";
cin >> maxRange;

while (maxRange <= 0)
{
cout << maxRange << "is not valid input the max range cannot be 0 or lower " << endl;

cin >> maxRange;
}
for (int countPrime = 2; countPrime <= maxRange; countPrime++) {
for (int counterDiv = countPrime * countPrime; countPrime < maxRange; primeSum += counterDiv)
{
if (counterDiv == 0)
{
cout << primeSum;
primeSum += counterDiv;
}
}
}
cout << "current sum: " << primeSum << endl;
cout << "enter answer(y/n):";
cin >> Stop;
primeSum = 0;

}
while (tolower(Stop) == 'y');

}

`
my solution the primitly is still going

@Theverytechnologypony Why not post this as a snippet on our GIT and link it. That way it will be formatted and we can read it.

@Theverytechnologypony snippets dont got o repos (or at leat they don have to and usually dont)... usually you post snippets at the top level and not associated with any repo. Half the point of snippets is to not be a repo.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.