f = @(c) sum(bitget(int8(c), 1:7));f('a')
Standard input is empty
ans = 3
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!