Average of first n even natural numbers | C # implementation to find Average of sum of first n natural even number ; function to find average of sum of first n even numbers ; sum of first n even numbers ; calculating Average ; driver code
using System ; class GFG { static int avg_of_even_num ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += 2 * i ; return ( sum / n ) ; } public static void Main ( ) { int n = 9 ; Console . Write ( avg_of_even_num ( n ) ) ; } }