update,
This commit is contained in:
17
_resources/it114105/itp3914/Lab07/Ex10.java
Normal file
17
_resources/it114105/itp3914/Lab07/Ex10.java
Normal file
@@ -0,0 +1,17 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Ex10 {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("How many values to enter? ");
|
||||
int size = input.nextInt();
|
||||
double sum = 0.0;
|
||||
for(int i = 0; i < size; i++){
|
||||
System.out.print("Value? ");
|
||||
sum += input.nextDouble();
|
||||
}
|
||||
System.out.println("Average = " + sum/size);
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user