+ 1
Write A Program to Find Sum Of Difference between Consecutive Prime Numbers which lie within the input range.
input : 4,20 output : 14 ((7-5)+(11-7) +(13-11)+(17-13)+(19-17)) = (2 + 4 +2 + 4 + 2)
3 Réponses
+ 1
I don't know answer someone please attempt this
0
Find all the primes between the given numbers and store them in an array. Run a loop and store the differences between two consecutive numbers in the above array and store them in a other array .Now run a last loop and find out the sum.