Last active
August 29, 2015 14:02
-
-
Save bvancil/9c58c94083f558a7f60a to your computer and use it in GitHub Desktop.
Square numbers modulo thirteen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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