// Create an array of 5 floats and calculate their sum

 


public class CDM_P6 {
public static void main(String[] args) {
float []mark = {56.9f,67.8f,78.9f,90.4f,34.9f};
float sum = 0;
for(float element:mark){
sum = sum + element
;
}
System.
out.println("Sum of arrays is :"+sum);

}
}

//output
Sum of arrays is :328.9 Process finished with exit code 0

Post a Comment

0 Comments