Why is this code not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is this code not working

I'm trying to get the prime numbers of a number using this method but it's not working. https://code.sololearn.com/cmBq7PYlz6RT/?ref=app

7th Sep 2020, 4:38 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
5 Answers
+ 4
it is just prime(10); And You printing only when if (x % y != 0 && x == y) Which is never going to true since x%y! =0 then it never x==y..
7th Sep 2020, 4:44 PM
Jayakrishna 🇮🇳
+ 2
Prime is a function with a parameter you must use it like prime(10); https://code.sololearn.com/c6WOBy9x3XAa/#cs try that
7th Sep 2020, 4:45 PM
Yahya Bey
Yahya Bey - avatar
+ 1
How i am suppose to fix it now
7th Sep 2020, 5:00 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
+ 1
Joseph Oritseweyinmi actually what are you trying here.. What prime numbers of a number..? Example? Prime factors or factors of a number..?
7th Sep 2020, 8:38 PM
Jayakrishna 🇮🇳
+ 1
I'm trying to get the prime factors of 10
7th Sep 2020, 8:47 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar