for (int x = 2; x < 100; x++) {
while (x % 2 != 0) {
int y = 2;
bool prime = true;
do {
if (x % y == 0) {
prime = false;
break;
}
y++;
} while (y < x);
if (prime) Console.WriteLine("{0} is prime!", x);
}
}
Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558