View Single Post
Old Apr 16th, 2005, 6:56 AM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Very good, that's not even the way I was thinking, but it works very nicely. Good job problem solving.

The final thing is to make the program more user-friendly. If it's not prime, the user might want to know why. Print which number caused the loop to break, to show which number it is equally divisible by.

P.S. Good catch on starting count at 2, because every number is divisible by 1. It could have taken a while to realise that error while debugging the problem.
Sane is offline   Reply With Quote