Skip to content

Instantly share code, notes, and snippets.

@gpetuhov
Created March 17, 2017 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpetuhov/4cccdeb0269570b084921e61901a11cc to your computer and use it in GitHub Desktop.
Save gpetuhov/4cccdeb0269570b084921e61901a11cc to your computer and use it in GitHub Desktop.
C++ For loop example
int main() {
int NUM_ITERATIONS = 0; //number of iterations
int i;
int sum = 0;
cout << "Enter number of iterations" << endl;
cin >> NUM_ITERATIONS;
for (i = 0; i < NUM_ITERATIONS; i++) {
sum++;
}
cout << "SUM = " << sum << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment