| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import java.util.Scanner;
- public class InputOutputArithMean {
-
- public static void main(String args[]) {
-
- Scanner scanner = new Scanner(System.in);
- String s;
- int i = 0;
- int m = 0;
-
-
- while (i < 1) {
- System.out.println("Bitte geben Sie die Anzahl der Zahlen ein, von denen Sie ein arithmetisches Mittel berechnen möchten:");
- try
- {
- i = scanner.nextInt();
- }
- catch(Exception ex) {
- System.out.println("Bitte überprüfen Sie ihre Eingabe");
- }
- }
-
- int[] arr = new int[i];
-
- for (int j = 0; j < i; j++) {
- System.out.println("Bitte geben Sie die " + j + "te Zahl ein:");
- try
- {
- /* arr[j] = scanner.nextInt(); */
- m += scanner.nextInt();
- }
- catch(Exception ex) {
- System.out.println("Bitte überprüfen Sie ihre Eingabe");
- }
-
-
- }
- System.out.println("keine Konvertierung, hier ist das Ergebnis: " + m / i);
- System.out.println(m / (double) i);
- }
-
-
- }
|