Pi的前800位

1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>

int main()
{
int a = 10000, b, c = 2800, d, e, f[2801], g;
for (; b - c;)
f[b++] = a / 5;
for (; d = 0, g = c * 2; c -= 14, printf("%.4d", e + d / a), e = d % a)
for (b = c; d += f[b] * a, f[b] = d % --g, d /= g--, --b; d *= b)
;
}

打印出程序自身

1
2
3
4
5
6
7
8
#include <stdio.h>

char *f = "char *f= %c%s%c;main(){printf(f,34,f,34,10);} %c";

int main()
{
printf(f, 34, f, 34, 10);
}

在屏幕上输出0-1000

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#define A(x) \
x; \
x; \
x; \
x; \
x; \
x; \
x; \
x; \
x; \
x;
int main(void)
{
int n = 1;
A(A(A(printf("%d ", n++))));
return 0;
}