for (int j=0,i = 1, k = 2;(j < n)^ (i < n)^ (k < n) ;j+=3,i+=3,k+=3) { } 

I accidentally found it somewhere, but I cannot find this program again.

Closed due to the fact that the essence of the question is incomprehensible by the participants of Sasha Omelchenko , Yuri , Kromster , αλεχολυτ , kmv 23 Mar '17 at 8:39 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • And what sobsno not like? except for the fact that n should have been defined earlier ... - Akina
  • five
    What is the question? Does your code compile? Well, take and try! - VladD

1 answer 1

 for (int j=0, i=1, k=2; (j<n) ^ (i<n) ^ (k<n); j+=3, i+=3, k+=3) 

Yes, the cycle can have this form. Runs as long as a truly odd number of conditions. That is, an odd number of variables is strictly less than n .

  • Ekoe zaboristoe condition, I wonder why this could be needed ... - rdorn
  • What does an inverted triangle mean? - Alexey Kryazhev
  • @ AlekseyKryazhev And this friend is called the logical exclusive OR operator - Ethernets
  • 2
    Why is this triangle turned upside down? o_O It seems the opposite, direct. - vp_arth