Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int bin_mult(int a, int b)
- {
- int res = 0;
- while(b)
- {
- if (b & 1) res += a;
- a <<= 1;
- b >>= 1;
- }
- return res;
- }
- int main()
- {
- std::cout << bin_mult(100, 100) << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment