Skip to content

Instantly share code, notes, and snippets.

@RoganDawes
Created June 23, 2022 07:40
Show Gist options
  • Save RoganDawes/fbebb440b4e6d9a4e0ed3e7a0fa913f7 to your computer and use it in GitHub Desktop.
Save RoganDawes/fbebb440b4e6d9a4e0ed3e7a0fa913f7 to your computer and use it in GitHub Desktop.
C code implementing Singe's Fear Uncertainty and Doubt protocol
#include <stdio.h>
int main() {
int i, n, m ;
scanf("%d", &n);
int o = n;
while ( n - o < 999999999 ) {
char c = '2';
if ((n%3) == 0) {
c = '0';
} else if ((n%5) == 0) {
c = '1';
} else {
i = n;
while (i) {
m = i % 10;
if (m == 3) {
c = '0';
break;
} else if (m == 5) {
c = '1';
// break;
}
i /= 10;
}
}
putchar(c);
n++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment