samedi 3 août 2019

Does continue statement really increases the speed of the loop in C++?

So, I am new to online competitive programming and i came across a code where i am using the if else statement inside a for loop. I want to increase the speed of the loop and after doing some research i came across break and continue statements.

So my question is that does using continue really increases the speed of the loop or not.

CODE :

int even_sum = 0;
for(int i=0;i<200;i++){
      if(i%4 == 0){
         even_sum +=i;
         continue;
      }else{
           //do other stuff when sum of multiple of 4 is not calculated
       }               
  }

Aucun commentaire:

Enregistrer un commentaire