View Code of Problem 3700

#include <stdio.h>
int main(){
	int n;
	int a[1000];
	int i=0,sum,j;
	while (scanf("%d",&n)!=EOF){
		if(n==0)
			break;
		else{
		while (n>0){
			a[i++]=n%2;
			n/=2;
		}
		sum=1;
		for(j=0;a[j]!=1;j++)
			sum*=2;
		printf("%d\n",sum);
		i=0;


		
	}
	}




	return 0;
}

Double click to view unformatted code.


Back to problem 3700