Find the Missing Number |  ; a represents the array n : Number of elements in array a ; Driver Code
using System ; class GFG { static int getMissingNo ( int [ ] a , int n ) { int i , total = 1 ; for ( i = 2 ; i <= ( n + 1 ) ; i ++ ) { total += i ; total -= a [ i - 2 ] ; } return total ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 5 } ; Console . Write ( getMissingNo ( arr , ( arr . Length ) ) ) ; } }