View Code of Problem 3700

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

Double click to view unformatted code.


Back to problem 3700