import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        System.out.println("sum of array");
  
        float []num = {50.2f,6.7f,80.35f,55.6f,78.0f};
    
         int lengthh = num.length;
          System.out.println("total elements in array "+lengthh);
          int a=0; 
          float sum =0;
          while (a<lengthh)
          {
               System.out.println(num[a]);
                sum = sum + num[a];
         
               a++;
      
          }     
          System.out.println("sum of array elements is "+sum);
            
  
  
  
  
  
  
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: