Check if a number is prime or not using C++. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!
What if you wanted your output to also show all non-price numbers their divisors? For example 6 so output would be “6 is not prime it’s divisors are (1 2 3)”
Hi, do you have any video that goes over system calls such as fork, exec, wait, and exit. More specifically, how to fork two child processes running the two programs generated in parallel? Thanks!
Technically you only need to check if n is divisible by all the numbers between 1 and floor(sqrt(n)). And then even further, you only need to check the prime numbers in this range which can be a useful optimisation if you are calculating all the primes less than some value
What if you wanted your output to also show all non-price numbers their divisors?
For example 6 so output would be “6 is not prime it’s divisors are (1 2 3)”
Which IDE used in this code
Hi,
do you have any video that goes over system calls such as fork, exec, wait, and exit. More specifically, how to fork two child processes running the two programs generated in parallel?
Thanks!
Not yet, but those are topics I absolutely want to cover. :-)
what IDE you using?
Oh my Lord, thank you sooooo much for the video. So intuitive and straight forward.
You’re very welcome, I’m glad you found it straight forward! :-)
Technically you only need to check if n is divisible by all the numbers between 1 and floor(sqrt(n)). And then even further, you only need to check the prime numbers in this range which can be a useful optimisation if you are calculating all the primes less than some value
Call i have all code
Can you name the compiler you are using ?
The IDE is Xcode on MacOS, I believe it uses the Clang compilers. :-)
@@PortfolioCourses Thanks :)
Tysm!
thank you
You’re welcome! :-)
thanks