Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int a = 32766;
- int b = 10383;
- int c = a;
- int d = 0;
- int checker = 1;
- while(b!=0){
- if(checker == (b & checker)){
- int i = 1;
- while(i!=checker){
- c = c + c;
- i = i + i;
- }
- // for(int i = 1; i < checker; i=i+i){
- // c = c + c;
- // }
- d = d + c;
- c = a;
- b = b - checker;
- checker = 1;
- }else{
- checker = checker + checker;
- }
- cout << b << " , " << checker << endl;
- }
- cout << "result : " << d;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement