Initialize two variables
var l = Math . pow ( 10 , N - 1 ) , r = Math . pow ( 10 , N ) - 1 ; if ( l == 1 ) l = 0 ; var ans = 0 ; for ( i = l ; i <= r ; i ++ ) { var even_sum = 0 , odd_sum = 0 ; var itr = 0 , num = reverse ( i ) ;