#include <iostream> #include <cstdio> #include <cmath> using namespace std; int main(){ int a,c[999],k; while(cin>>a&&a!=0){ k=0; while(a){ c[k++]=a%2; if(a%2==1) break; a=a/2; } cout<<pow(2,k-1)<<endl; } return 0; } |
Double click to view unformatted code.