View Code of Problem 3700

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0)	break;
		int a[100]={0},i=0,j;
		while(n){
			a[i++]=n%2;
			n/=2;
		}
		for(j=0;j<100;j++){
			if(a[j]==1)	break;
		}
		cout<<pow(2,j)<<endl;
	}
} 

Double click to view unformatted code.


Back to problem 3700