Traversing the String
for ( int i = 0 ; i < num . Length ; i ++ ) if ( i % 2 == 0 ) sumOdd = sumOdd + ( num [ i ] - '0' ) ; else sumEven = sumEven + ( num [ i ] - '0' ) ; Console . WriteLine ( " Sum ▁ odd ▁ = ▁ " + sumOdd ) ; Console . WriteLine ( " Sum ▁ even ▁ = ▁ " + sumEven ) ; }