Computer Science, asked by arpitanarayan656, 6 months ago

write a program in java to input n numbers in an array and find the sum of all the prime numbers.​

Answers

Answered by devnaguleria32646
0

Answer:

To find sum of all elements, iterate through each element and add the current element to the sum. Which is run a loop from 0 to n. The loop structure should look like for(i=0; i<n; i++). Inside the loop add the current array element to sum i.e. sum = sum + arr[i] or even you can do sum += arr[i]

Similar questions