+ 3

Prime number in C++?

If i have range of values that I need to check if it prime or not? What can i do ;(!!

14th Feb 2018, 2:50 PM
Latifah Almulhim
12 Answers
+ 9
@@Latifah Almulhim ohh sorry 😊😊
15th Feb 2018, 6:51 PM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 8
check this java version i think you like!! https://code.sololearn.com/c8KCZTNWXzC8/?ref=app
15th Feb 2018, 6:42 PM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 8
@@Latifah Almulhim, welcome
15th Feb 2018, 6:54 PM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 8
Latifah Almulhim welcome!! 👍👍
30th Aug 2018, 5:36 PM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 7
@@Latifah Almulhim, enter any number and check the output if you find help full then i will convert this program into c or c++ any language that you prefer
15th Feb 2018, 6:49 PM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 5
You should check out the sieve of Eratosthenes for prime numbers. There are plenty of codes out in the public for using this method. Good luck!
14th Feb 2018, 2:58 PM
Zeke Williams
Zeke Williams - avatar
+ 4
step 1: create a function which accepts a number and returns a boolean statement (true, false) step 2: create a for loop which increments the starting point until it reaches the end of the range step 3: place the function call inside the loop and feed the iterator of the loop into it if it outputs true -> prime -> print iterator if it outputs false -> no prime If you need help with a step feel free to ask again. But I won't give a complete solution :P
14th Feb 2018, 2:58 PM
Alex
Alex - avatar
+ 3
Thank you all
14th Feb 2018, 3:12 PM
Latifah Almulhim
14th Feb 2018, 3:05 PM
Vijay
Vijay - avatar
+ 1
I didn’t learn Java yet. 😅
15th Feb 2018, 6:45 PM
Latifah Almulhim
+ 1
Now I know how to make program for prime numbers . I upload the code.
15th Feb 2018, 6:48 PM
Latifah Almulhim
+ 1
@Asif Bilakhiya Thanks đŸ™đŸ»
15th Feb 2018, 6:53 PM
Latifah Almulhim