I want a very short code (maximum 6 lines code) for identifying the given input is prime number or not ???
shubham05 0 Newbie Poster
Recommended Answers
Jump to PostOne of the quickest ways is to check if n divided by 2....sqrt(n) results in an even number. If any of them do the number is not prime.
so:
detemine square root of n (rounded up)loop through 2 to square root of n, dividing n by number. If even …
All 3 Replies
Hiroshe 499 Posting Whiz in Training
hericles 289 Master Poster Featured Poster
shubham05 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.