Find the Batting Average of a batsman | C # program to calculate the average of a batsman ; Function to find the average of a batsman ; Calculate number of dismissals ; Check for 0 times out ; Calculate batting average ; Driver code
using System ; class GFG { static int averageRuns ( int runs , int matches , int notout ) { int out1 ; out1 = matches - notout ; if ( out1 == 0 ) return - 1 ; int avg = ( runs ) / out1 ; return avg ; } public static void Main ( string [ ] args ) { int runs = 10000 ; int matches = 250 ; int notout = 50 ; int avg = averageRuns ( runs , matches , notout ) ; if ( avg == - 1 ) Console . Write ( " NA " ) ; else Console . Write ( avg ) ; } }