Question:

How to compute average in Dr. Java ?

by  |  earlier

0 LIKES UnLike

How to write a program that can compute the average of these values ?

Rainfall for April: 12

Rainfall for May : 14

Rainfall for June: 8

Average rainfall: 11.333333

 Tags:

   Report

1 ANSWERS


  1. public class avg {

      public static void main(String[] args){

      double april=12;

      double may=14;

      double june=8;

    double total = april+may+june;

    System.out.println("Average rainfall: " + (total/3));

    }

    }

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.