0
How to take out average ????
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); double score1 = read.nextDouble(); double score2 = read.nextDouble(); double score3 = read.nextDouble(); double score4 = read.nextDouble(); double avgScore = getAverageScore(score1, score2, score3, score4); System.out.println(avgScore); } //create your method here public static double getAverageScore() { } }
5 Réponses
+ 1
Can you tell me how do you take out average in maths?
+ 1
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
double score1 = read.nextDouble();
double score2 = read.nextDouble();
double score3 = read.nextDouble();
double score4 = read.nextDouble();
double avgScore = getAverageScore(score1, score2, score3, score4);
System.out.println(avgScore);
}
//create your method here
public static double getAverageScore(double a, double b, double c, double d) {
double avg=(a+b+c+d)/4;
return avg;
}
}
//Tell me if you want any more help
+ 1
My pleasure
0
By adding all the values by total no. Of values ..
Eg ->2,3,4,5,2
Avg= (2+3+4+5+2)/5
=16/5
=3.2 ans
0
Thank uu Atul...😀😀😀😀