Skip to content

Instantly share code, notes, and snippets.

@marzoukali
Created May 29, 2017 15:26
Show Gist options
  • Select an option

  • Save marzoukali/1fdd9b6b741e0a8317591a75e94fbc74 to your computer and use it in GitHub Desktop.

Select an option

Save marzoukali/1fdd9b6b741e0a8317591a75e94fbc74 to your computer and use it in GitHub Desktop.
C++ Simple Problems - Problem 2 - Second Trial
int count = 0;
for(int x =1; x<=100;++x)
 {
 int y = 70
 
 if(x > y) y = x + 1; // If X already bigger than start of Y so skip all the small Y and move to y = x + 1; to enhance performance.
 
 for(; y<=200; y++)
 {
 if((x+y) % 7 == 0) count++;
 }
}
cout << count;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment