+ 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

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..

+ 2

Prime is a function with a parameter you must use it like prime(10);
https://code.sololearn.com/c6WOBy9x3XAa/#cs
try that

+ 1

How i am suppose to fix it now

+ 1

Joseph Oritseweyinmi actually what are you trying here.. What prime numbers of a number..? Example?
Prime factors or factors of a number..?

+ 1

I'm trying to get the prime factors of 10

Hot today

How to read this?

1 Votes

How does this works?

1 Votes

Class and instance attributes

0 Votes

Please help

1 Votes