Skip to content

Instantly share code, notes, and snippets.

@bvancil
Last active August 29, 2015 14:02
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 bvancil/9c58c94083f558a7f60a to your computer and use it in GitHub Desktop.
Save bvancil/9c58c94083f558a7f60a to your computer and use it in GitHub Desktop.
Square numbers modulo thirteen
// Copy and paste into http://www.compileonline.com/compile_cpp11_online.php to run.
#include <iostream>
using namespace std;
int main()
{
int n2Mod13;
for (int n=0; n<100; n++) {
n2Mod13 = (n*n) % 13;
for (int count=0; count<n2Mod13; count++)
cout << "*"; // This happends as many times as the inner for-loop runs. Note that you don't need curly braces for just one statement.
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment