View Code of Problem 3700

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

Double click to view unformatted code.


Back to problem 3700