Each time sum is added to its previous sum . Multiplying the three factors as explained above . int ( s [ i ] ) is done to convert char to int .
sum = sum + ( int ( num [ i ] ) ) * ( i + 1 ) * mf NEW_LINE