12
Question Question 12
Write a code segment to compute the sum of all positive real numbers stored in the following array.
double numb[] = new double[50];double sum = 0;
for (int i = 0; i < 50; i++) {
if (numb[i] > 0) {
sum += numb[i];
}
}
System.out.println("Sum of positive real numbers = " + sum);