fork download
  1. #include <stdio.h>
  2.  
  3. void printbinary(unsigned x, unsigned count){
  4.  
  5. printf("%d ",x);
  6.  
  7. putchar('b');
  8.  
  9. while (0 < count){
  10. putchar(((x >> (count - 1u)) & 1u) + '0');
  11. count--;
  12. }
  13.  
  14. putchar('\n');
  15. }
  16.  
  17. int main(void) {
  18. int i = 0;
  19. while (i<256) {printbinary(i, 8); i++;}
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
0 b00000000
1 b00000001
2 b00000010
3 b00000011
4 b00000100
5 b00000101
6 b00000110
7 b00000111
8 b00001000
9 b00001001
10 b00001010
11 b00001011
12 b00001100
13 b00001101
14 b00001110
15 b00001111
16 b00010000
17 b00010001
18 b00010010
19 b00010011
20 b00010100
21 b00010101
22 b00010110
23 b00010111
24 b00011000
25 b00011001
26 b00011010
27 b00011011
28 b00011100
29 b00011101
30 b00011110
31 b00011111
32 b00100000
33 b00100001
34 b00100010
35 b00100011
36 b00100100
37 b00100101
38 b00100110
39 b00100111
40 b00101000
41 b00101001
42 b00101010
43 b00101011
44 b00101100
45 b00101101
46 b00101110
47 b00101111
48 b00110000
49 b00110001
50 b00110010
51 b00110011
52 b00110100
53 b00110101
54 b00110110
55 b00110111
56 b00111000
57 b00111001
58 b00111010
59 b00111011
60 b00111100
61 b00111101
62 b00111110
63 b00111111
64 b01000000
65 b01000001
66 b01000010
67 b01000011
68 b01000100
69 b01000101
70 b01000110
71 b01000111
72 b01001000
73 b01001001
74 b01001010
75 b01001011
76 b01001100
77 b01001101
78 b01001110
79 b01001111
80 b01010000
81 b01010001
82 b01010010
83 b01010011
84 b01010100
85 b01010101
86 b01010110
87 b01010111
88 b01011000
89 b01011001
90 b01011010
91 b01011011
92 b01011100
93 b01011101
94 b01011110
95 b01011111
96 b01100000
97 b01100001
98 b01100010
99 b01100011
100 b01100100
101 b01100101
102 b01100110
103 b01100111
104 b01101000
105 b01101001
106 b01101010
107 b01101011
108 b01101100
109 b01101101
110 b01101110
111 b01101111
112 b01110000
113 b01110001
114 b01110010
115 b01110011
116 b01110100
117 b01110101
118 b01110110
119 b01110111
120 b01111000
121 b01111001
122 b01111010
123 b01111011
124 b01111100
125 b01111101
126 b01111110
127 b01111111
128 b10000000
129 b10000001
130 b10000010
131 b10000011
132 b10000100
133 b10000101
134 b10000110
135 b10000111
136 b10001000
137 b10001001
138 b10001010
139 b10001011
140 b10001100
141 b10001101
142 b10001110
143 b10001111
144 b10010000
145 b10010001
146 b10010010
147 b10010011
148 b10010100
149 b10010101
150 b10010110
151 b10010111
152 b10011000
153 b10011001
154 b10011010
155 b10011011
156 b10011100
157 b10011101
158 b10011110
159 b10011111
160 b10100000
161 b10100001
162 b10100010
163 b10100011
164 b10100100
165 b10100101
166 b10100110
167 b10100111
168 b10101000
169 b10101001
170 b10101010
171 b10101011
172 b10101100
173 b10101101
174 b10101110
175 b10101111
176 b10110000
177 b10110001
178 b10110010
179 b10110011
180 b10110100
181 b10110101
182 b10110110
183 b10110111
184 b10111000
185 b10111001
186 b10111010
187 b10111011
188 b10111100
189 b10111101
190 b10111110
191 b10111111
192 b11000000
193 b11000001
194 b11000010
195 b11000011
196 b11000100
197 b11000101
198 b11000110
199 b11000111
200 b11001000
201 b11001001
202 b11001010
203 b11001011
204 b11001100
205 b11001101
206 b11001110
207 b11001111
208 b11010000
209 b11010001
210 b11010010
211 b11010011
212 b11010100
213 b11010101
214 b11010110
215 b11010111
216 b11011000
217 b11011001
218 b11011010
219 b11011011
220 b11011100
221 b11011101
222 b11011110
223 b11011111
224 b11100000
225 b11100001
226 b11100010
227 b11100011
228 b11100100
229 b11100101
230 b11100110
231 b11100111
232 b11101000
233 b11101001
234 b11101010
235 b11101011
236 b11101100
237 b11101101
238 b11101110
239 b11101111
240 b11110000
241 b11110001
242 b11110010
243 b11110011
244 b11110100
245 b11110101
246 b11110110
247 b11110111
248 b11111000
249 b11111001
250 b11111010
251 b11111011
252 b11111100
253 b11111101
254 b11111110
255 b11111111