How to take out average ???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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() { } }

26th May 2021, 10:56 AM
Prathmesh Kumar
Prathmesh Kumar - avatar
5 Answers
+ 1
Can you tell me how do you take out average in maths?
26th May 2021, 12:13 PM
Atul [Inactive]
+ 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
26th May 2021, 12:19 PM
Atul [Inactive]
+ 1
My pleasure
26th May 2021, 12:24 PM
Atul [Inactive]
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
26th May 2021, 12:16 PM
Prathmesh Kumar
Prathmesh Kumar - avatar
0
Thank uu Atul...😀😀😀😀
26th May 2021, 12:20 PM
Prathmesh Kumar
Prathmesh Kumar - avatar