Average of ASCII values of characters of a given string | C # code to find average of ASCII characters ; Function to find average of ASCII value of chars ; loop to sum the ascii value of chars ; Returning average of chars ; Driver code
using System ; class GFG { public static int averageValue ( String s ) { int sum_char = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { sum_char += ( int ) s [ i ] ; } return sum_char / s . Length ; } public static void Main ( ) { String s = " GeeksforGeeks " ; Console . Write ( averageValue ( s ) ) ; } }