+ 2

Why it doesn't work properly?

This C program takes a number and displays 2 prime numbers which their sum is equal to the number we entered but in the results all the numbers are not prime! Why? prime1(i) + prime2(j) == n https://code.sololearn.com/ciC9chJ7340J/?ref=app

1st Feb 2022, 4:55 PM
Amateur
4 Respuestas
+ 1
Oh.. Use the for loop condition <= instead of < in prine function... , Or use for(i = 3; i <= n/2; i += 2){
1st Feb 2022, 5:11 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 for example when u enter 20, the results are: 3 17 7 13 9 11 But 9 is not Prime!!!!
1st Feb 2022, 5:06 PM
Amateur
+ 2
Jayakrishna🇮🇳 THANKKKKKK U
1st Feb 2022, 5:19 PM
Amateur
0
Not clear.. 'All numbers are not prime' But am getting primes only...
1st Feb 2022, 5:03 PM
Jayakrishna 🇮🇳