Content deleted Content added
No edit summary |
→Examples: Corrected the code to match with the image of the original printed document (https://www.bell-labs.com/usr/dmr/www/kbman.pdf). For example, spaces are never used after keywords such as if and while, and code is indented three columns. Tags: Mobile edit Mobile web edit |
||
Line 83:
/* The following function will print a non-negative number, n, to
the base b, where 2<=b<=10. This routine uses the fact that
in the
code values. */
printn(n,
}
</syntaxhighlight>
Line 102:
/* The following program will calculate the constant e-2 to about
4000 decimal digits, and print it 50 characters to the line in
groups of 5 characters. The method is simple output
sion of the expansion
1/2! + 1/3! + ... = .111
where the bases of the digits are 2, 3, 4, .
main() {
while(col<2*n) {▼
a = n+1;▼
c = i = 0;▼
c =+ v[i] *10;▼
v[i++] = c%a;▼
c =/ a--;▼
}▼
putchar(c+'0');▼
if(!(++col%5))▼
putchar(col%50?' ': '*n');▼
while(i<n) {
putchar('*n*n');▼
}
}
v[2000];
n 2000;
|