Maximum students to pass after giving bonus to everybody and not exceeding 100 marks | C # Implementation of above approach . ; Function to return the number of students that can pass ; maximum marks ; maximum bonus marks that can be given ; counting the number of students that can pass ; Driver code
using System ; using System . Collections . Generic ; using System . Collections ; using System . Linq ; class GFG { static int check ( int n , List < int > marks ) { int x = marks . Max ( ) ; int bonus = 100 - x ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( marks [ i ] + bonus >= 50 ) c += 1 ; } return c ; } public static void Main ( ) { int n = 5 ; List < int > marks = new List < int > ( new int [ ] { 0 , 21 , 83 , 45 , 64 } ) ; Console . WriteLine ( check ( n , marks ) ) ; } }