mercredi 29 juillet 2020

Multiple condition in for loop not working in c++

I am trying to print all occurring even numbers up to 20. The code is working fine with if condition, but not working with multiple conditions in loop.

    ```  
    #include<iostream>
    using namespace std;
    int main() {
     for(int i = 1; ((i <= 20) && (i % 2 == 0)); i ++) cout << i << endl;
    }
    ```

Aucun commentaire:

Enregistrer un commentaire