blob: 7aa5265d0664198c4385f0f8f69a92ce1cfa756e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <stdio.h>
#include <stdlib.h>
main ()
{
long int i=1,j=i;
/* title */
puts("Bits\tRange");
puts("----\t-----");
/* O/P data and calc the next
* set of values */
for (i=1; i<=32; i++)
{
printf("%2ld\t0-%12lu\n", i, j*=2);
}
}
/************************************************************************
* Bits Range
* ---- -----
* 1 0- 1
* 2 0- 3
* 3 0- 7
* 4 0- 15
* 5 0- 31
* 6 0- 63
* 7 0- 127
* 8 0- 255
* 9 0- 511
* 10 0- 1023
* 11 0- 2047
* 12 0- 4095
* 13 0- 8191
* 14 0- 16383
* 15 0- 32767
* 16 0- 65535
* 17 0- 131071
* 18 0- 262143
* 19 0- 524287
* 20 0- 1048575
* 21 0- 2097151
* 22 0- 4194303
* 23 0- 8388607
* 24 0- 16777215
* 25 0- 33554431
* 26 0- 67108863
* 27 0- 134217727
* 28 0- 268435455
* 29 0- 536870911
* 30 0- 1073741823
* 31 0- 2147483647
* 32 0- 4294967295
*/
|