Inclusion Exclusion Concept + Implementation(my java code is not working)

public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
int primes[]={2,3,5,7,11,13,17,19};
int t=sc.nextInt();
int aswer =0;
while(t>=0){
int n= sc.nextInt();
int subsets =(1<<8)-1;
for (int i=1;i<=subsets;i++){
int denom=1;
int setBits = Integer.bitCount(i);
for(int j=0;j<8;j++){
if((i &(1<<j))==1)
denom = denom* primes[j];
}
if((setBits&1)==1)
aswer = aswer+(n/denom);
else
aswer = aswer-(n/denom);
}
System.out.println(aswer);
t–;
}

}

@abdullahalnomancse_f85bf5e5dcddaf61, please share code on Cb online ide

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

how to share the code?

BFS part is not working

@abdullahalnomancse_f85bf5e5dcddaf61 bfs code in Inc exc topic?

yes in java ( Ace the Placements - Java)

No i meant u asked in this doubt some bit thing right?

oh no no it was previous problem.