Header Ads

LATEST POST
recent

JAVA Programs to Find Average of any set of Numbers

Java Program to Find Average of any set of Numbers: Below contain the Java Program code to find average value of any set of numbers one to infinity.



JAVA Programs to Find Average of any set of Numbers
NetBeans 8.2




import java.util.Scanner;
public class JavaStart {

    public static void main(String[] args) {
      double sum = 0.0;
      Scanner input = new Scanner (System.in);
      System.out.println("Enter the Value of the Total Number in The Set");
      int n = input.nextInt();
      for (int i = 1; i<=n; i++){
          System.out.println("Input the Number in the set (one per time)");
          double value = input.nextDouble();
          sum = sum + value;
      }

      double average = sum/n;
           System.out.println("The Average of the set of numbers is " + average);
      }
   
}



Click below to send me message directly using facebook







No comments:

Powered by Blogger.