Java ? create array of 5 float and print sum of present...

class Main{
  public static void main(String args[]){
    float [] marks = {1.5f,1.6f,1.7f,1.8f,1.9f};
    float fin =0;
    float sum = 0;
    
    for (float element : marks){
      sum = sum + element;
           
    }
    
    System.out.println(sum);
  }   
  
}
Ranjit Patil

Ranjit is a passionate engineer specializing in AI/ML, Java, and Spring Boot. He loves talking about technology and is endlessly curious about the creation of the universe.

Post a Comment

comment here

Previous Post Next Post