+ 2

What is the difference?

There are 2 similar codes but just one of them works properly... why? https://code.sololearn.com/cg8ouHd1Uvuf/?ref=app https://code.sololearn.com/cE1GNBR2rHH8/?ref=app

2nd Feb 2022, 6:59 AM
Amateur
7 Respostas
+ 2
Change the print statement (n-1) to (n-i)
2nd Feb 2022, 7:18 AM
VRVivek
+ 3
Change it to if(prime(i) && prime(n - i))
2nd Feb 2022, 7:14 AM
VRVivek
+ 2
VRVivek i finally got it, Thanks
2nd Feb 2022, 7:26 AM
Amateur
+ 1
In code 2 the if condition is wrong. that's why it's not working.
2nd Feb 2022, 7:11 AM
VRVivek
+ 1
VRVivek which if condition?
2nd Feb 2022, 7:13 AM
Amateur
+ 1
if(prime(i) && prime(n - 1))
2nd Feb 2022, 7:14 AM
VRVivek
+ 1
VRVivek oh..ok... but still the results are not the same!!!
2nd Feb 2022, 7:17 AM
Amateur