see the topic
nothing too advanced... im only up to looping. if statements and variables
This is a discussion on determining if a # is prime within the C++ Programming forums, part of the General Programming Boards category; see the topic nothing too advanced... im only up to looping. if statements and variables...
see the topic
nothing too advanced... im only up to looping. if statements and variables
There was a good thread on this topic last week. please search the board
isn't a prime an even number? so then it's divisible by 2...
if(number%2==0){//If the number is divisible by 2 it will have a remainder of 0 and thus we call it prime, if it has a remainder then we call it (I forget the term)
}
else //everthing else, not prime numbers
My Avatar says: "Stay in School"
Rocco is the Boy!
"SHUT YOUR LIPS..."
No.Originally posted by OneStiffRod
isn't a prime an even number? so then it's divisible by 2...
if(number%2==0){//If the number is divisible by 2 it will have a remainder of 0 and thus we call it prime, if it has a remainder then we call it (I forget the term)
}
else //everthing else, not prime numbers
Prime numbers are numbers that are only be divisible by 1 and themself.Originally posted by OneStiffRod
isn't a prime an even number? so then it's divisible by 2...
if(number%2==0){//If the number is divisible by 2 it will have a remainder of 0 and thus we call it prime, if it has a remainder then we call it (I forget the term)
}
else //everthing else, not prime numbers
Anyway, that thread is right here
http://www.cprogramming.com/cboard/s...ighlight=prime
Last edited by _Will333_; 02-25-2002 at 09:26 PM.
"I once saw a photograph of a large
herd of wild elephants in Central
Africa seeing an airplane for the first
time, and all in a state of wild
collective terror... As, however, there
were no journalists among them, the
terror died down when the airplane
was out of sight. "
- Bertrand Russell