Skip to content

Instantly share code, notes, and snippets.

@ptrcarta
Created January 29, 2016 18:07
Show Gist options
  • Save ptrcarta/2babd4d596db5d723d4b to your computer and use it in GitHub Desktop.
Save ptrcarta/2babd4d596db5d723d4b to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define OF 36
#define ROWS 8
char lookup[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void print(char *buf) {
int n;
for (n = ROWS - 1 ; n > 0; n--) {
if (buf[n] != 0) break;
}
for (int i = 0; i <= n; i++) {
putchar(lookup[buf[n - i]]);
} puts("=0_");
}
int main (int argc, char* argv[]) {
char aba[ROWS];
for (int i = 0; i < ROWS; i++) {
aba[i] = 0;
}
print(aba);
for (long long n = 0; n < atoll(argv[1]); n++) {
int i = 0;
while (i < ROWS) {
aba[i]++;
if (aba[i] == OF) {
aba[i] = 0;
i++;
} else {
break;
}
}
print(aba);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment