Menu
Question Index
...

Write a program to find the average of all even numbers till a given number.

Input (Integer) Output (Integer)
7 (2 + 4 + 6) / 3 = 4
15 (2 + 4 + 6 + 8 + 10 + 12 + 14) / 7 = 8



class Average
{
    public static void main(String s[])
    {
        System.out.println("Average of even numbers till 10 is " + averageOfEvenNumbers(10));

    }


    public static int averageOfEvenNumbers(int input)
    {
        int output = 0;
        return output;
    }

}

Doubts

Problems

Topic: for Loop In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App