First of all, what did you do to get the code to print with colors like you did?
And has anyone explained code formatting? Indentation is necessary to understand code.
The problem is you don't seem to know how to test for prime numbers.
You actually have to test the number to see if it's prime from 2 up to the number (shorter is possible, but not yet). You can't just test if it's divisible by 2 and 3. There's also 5, 7, 11, etc.
And after you test the value you increment the number you input, so if you entered 22 you end up testing 22, 23, 24, 25, ..., infinity.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Maybe this would interest you...
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Maybe this would interest you...
I think his TA would look right through that as somebody else's fairly sophisticated code!
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417