If problem

Hey, I need help. I don't know why but the second part of the if it doesn't work.
And i don't get any number printed.

1
2
3
4
5
for(i=0;i<n;i++){
    for(j=0;j<n;j++){
        if(a[i]*2==a[j] && a[i]/2==a[j])
            cout<<a[i]<<endl;
    }
This is a maths problem: you have a number M and you want a number N such that N*2 = M and, at the same time, N/2 = M. Well, this number can only be 0! So probably there is something wrong: did you mean to make the OR of those conditions?
Thank you!! you made me find my mistake :)
Topic archived. No new replies allowed.