text: Average of first n odd naturals numbers | C # program to find average of sum of first n odd natural numbers . ; Returns the Avg of first n odd numbers ; sum of first n odd number ; Average of first n odd numbers ; Driver code
code: using System ; class GFG { static int avg_of_odd_num ( int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += ( 2 * i + 1 ) ; return sum / n ; } public static void Main ( ) { int n = 20 ; avg_of_odd_num ( n ) ; Console . Write ( avg_of_odd_num ( n ) ) ; } }