Skip to content

Instantly share code, notes, and snippets.

@Tricky1975
Created September 25, 2022 15:53
Show Gist options
  • Save Tricky1975/0ccf810b804422571b3d08e5d0187f5b to your computer and use it in GitHub Desktop.
Save Tricky1975/0ccf810b804422571b3d08e5d0187f5b to your computer and use it in GitHub Desktop.
A nice mathematical thing worked out.
#include <iostream>
#include <string>
using namespace std;
typedef unsigned long long ui;
int main() {
char t[20];
for(ui i=1;i<=9;++i){
for(char j=0;j<i;++j) {t[j]=(char)49+j; t[i+1]=0;}
ui cijfer1{stoi(t)};
cout << cijfer1 << " x 8 + " << i << " = ";
cout << cijfer1 * 8 + i;
cout << endl;
}
return 0;
}
@Tricky1975
Copy link
Author

Tricky1975 commented Sep 25, 2022

image
When this picture was posted by a Twitter friend of mine I simply had to try this out. And see here the result.

(Below a 'playground' screenshot).
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment