//odds
#include<stdio.h>
int main()
{
long long int t;
scanf("%lld",&t);
while(t–)
{
long long int n,i,j;
scanf("%lld",&n);
j=1;
while(j<=n)
{
for(i=j;i<=(j2-1);i++)
{
if(i==n)
{
printf("%lld\n",j);
break;
}
}
j=j2;
}
}
return 0;
}
in this question the output should be “the largest power of 2 less than or equal to n”. There are 2 ways to do so:
for(i=1;i<n;i*=2);
if(i!=n)
i/=2;
printf("%d\n",i);
OR
you can try:
int p=pow(2,floor(log2(n)));
printf("%d\n",p);