Friday, May 31, 2019

how to calculate mean using an array in java NetBeans

 click the link below to download the source code



public class CalculateMean {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
      int numbers[] = {10,7,4,1};
      int sum =0;
      float mean;
      //System.out.println(Arrays.toString(numbers));
      for(int num:numbers){
        sum = sum +num;
      }
      mean = sum/(float)numbers.length;
      System.out.println(mean);
     
    }
   
}















watch the video on my your tube channel please don't forget to like, share and subscribe on my channel for more videos thank you


click the link below to download the source code

http://www.mediafire.com/file/2jm68m652n4fa29/calculateMean.zip/file

No comments:

Post a Comment

Contact Us

Name

Email *

Message *