Prog to extract bits from a number