Dizideki Elemanların Ortalamasını Hesaplayan Program

public class Main {
    public static void main(String[] args) {
        int[] numbers = {1, 2, 3, 4, 5};
        int sum = 0;
        for (int i = 0; i < numbers.length; i++) {
            sum += numbers[i];
        }

        System.out.println(sum / numbers.length);
    }
}

Ödev

Dizideki sayıların harmonik ortalamasını hesaplayan programı yazınız.

Harmonik Ortalama formülü : n (eleman sayısı) / elemanların harmonik serisi

Harmonik Seri Formülü :

Ödev

Submit your work to complete this lesson.

Join the project workspace to share your solution and receive feedback.

Lesson discussion

Swap insights and ask questions about Java101

Be the first to start the discussion

Ask a question or share your thoughts about this lesson.