forked from safesit23/JavaLabExercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindMean.java
More file actions
28 lines (23 loc) · 706 Bytes
/
Copy pathFindMean.java
File metadata and controls
28 lines (23 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
public class FindMean {
public static void main(String[]args){
Scanner input = new Scanner(System.in);
int total=0,user,count=0;
double xbar;
System.out.print("Enter Value: ");
user =input.nextInt();
while(user!=-1){
total = valueall(total,user);
count++;
System.out.print("Enter Value: ");
user =input.nextInt();
}
xbar=total/count;
System.out.println("Mean is "+xbar);
System.out.println(""+count+","+total);
}
public static int valueall(int total,int user){
total = total+user;
return total;
}
}