0
Java program
Please tell me how can i shorten this code.. https://code.sololearn.com/cao6p8AhR4Rg/?ref=app
5 ответов
0
Shorter != Better.
You can easily remove one of your loops and many variables:
https://code.sololearn.com/c7Qbq3inCjo4/?ref=app
+ 1
Sandra Meyer thanks for your reply
But the code that you've sent is not doing what it was supposed to do..
If the input is 10
It doesn't show the prime factors of 10 (2,5) but shows all the prime numbers smaller than 10 😅
+ 1
Oh, right, but that's a small modification...
+ 1
Only found this as python, but I modified it now for you in the code above. Makes one loop much shorter and the condition longer.
+ 1
Sandra Meyer Thanks 😅