Skip to content

Instantly share code, notes, and snippets.

@juanfal
Created October 15, 2024 12:30
Show Gist options
  • Save juanfal/3cbe9584f98d2f2dc17eacb33a11f5b6 to your computer and use it in GitHub Desktop.
Save juanfal/3cbe9584f98d2f2dc17eacb33a11f5b6 to your computer and use it in GitHub Desktop.
print continous counter
// 08.triangleContDigits.cpp
// juanfc 2024-10-07
//
#include <iostream>
using namespace std;
int main()
{
int gCounter = 1;
int n = 12; // or cin >> n;
for (int line = 1; line <= n; ++line) {
for (int i = 0; i < line; ++i)
cout << gCounter++ % 10;
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment