4 Antworten
+ 5
You use a counter/flag and check for remainders with each number less than that number and if the remainder is 0, you have a factor. So, that number isn't a prime number.
Thus, for whichever number the flag remains off, or the counter 0, that numbers would be prime.
John Champion🖤🔥 Try it out yourself. If you need more help, feel free to ask.
Guezi Louay I don't think you should give away the code right away. You should just let them off with some hints so that they could practice and learn. Getting the answer is never the solution, the process matters.
+ 2
Kainatic ..Thank you so much
Your reply was more like a normal person❤️
+ 1
here’s my way of finding a certain amount of primes, it’s not the shortest code, but i wanted to make it as efficiënt as i could so yeah.. i just try to devide a number by all the primes that are smaller than that number and if the outcome is never 0 it’s a prime and than i just test the next number...
https://code.sololearn.com/cXP80RNTKJOs/?ref=app