0

Java program

Please tell me how can i shorten this code.. https://code.sololearn.com/cao6p8AhR4Rg/?ref=app

13th Jul 2020, 1:08 PM
SHIVANSH
SHIVANSH - avatar
5 ответов
0
Shorter != Better. You can easily remove one of your loops and many variables: https://code.sololearn.com/c7Qbq3inCjo4/?ref=app
14th Jul 2020, 4:15 AM
Sandra Meyer
Sandra Meyer - avatar
+ 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 😅
16th Jul 2020, 10:31 AM
SHIVANSH
SHIVANSH - avatar
+ 1
Oh, right, but that's a small modification...
16th Jul 2020, 12:12 PM
Sandra Meyer
Sandra Meyer - avatar
+ 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.
16th Jul 2020, 12:54 PM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Sandra Meyer Thanks 😅
16th Jul 2020, 1:59 PM
SHIVANSH
SHIVANSH - avatar