The program is suppose to output all the prime numbers between 3 and 100.
It acutally outputs all numbers between 3 and 100.
My code is as follows:
#include <iostream>
using namespace std;
int main ()
{
int number=3, count=2;
while (number <= 100)
{
if ((number % count) > 0)
{
cout << number << " ";
number++;
count = 2;
}
else
{
count++;
}
}
cout << endl;
return 0;
}
Does anyone see my mistake(s) and know what I need to do? Any help would be appreciated.