#include "stdio.h" #include "string.h" void main() { int x,i,j; int n; int a[100]; int two; for(;scanf("%d",&n)!=EOF;) { if(n==0) break; //if(n==1) //{printf("1\n");continue;} two=1; for(i=0;n!=0;i++) { a[i]=n%2; n=n/2; // printf("%d ",a[i]); } i=0; for(i=0;a[i]!=1;i++) { two=two*2; } printf("%d\n",two); } } |
Double click to view unformatted code.