View previous topic :: View next topic
|
Author |
Message |
mohit123
New User
Joined: 27 Sep 2006 Posts: 1
|
|
|
|
can any body help me in writing a prime number program |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi mohit,
1) take the number WS-CTR1 from user /JCl
2) Now get the square root of the number using some math function & move it to WS-CTR2.
3)Now check whether WS-CTR1 is divisible by any number between 2 & WS-CTR2
4)If it is divisible then it is not a prime number otherwise it 's prime number.
Please let me know if u need any further explanation |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
In the following link you can find some explanations + pseudo code. Good luck.
O. |
|
Back to top |
|
|
|