fork(2) download
  1. #include <stdio.h>
  2.  
  3. int checkParity(unsigned char a) {
  4. int odd = 0;
  5. while( a ) {
  6. odd ^= a & 1;
  7. a >>= 1;
  8. }
  9. return odd;
  10. }
  11.  
  12. int main(void) {
  13. int i = 0;
  14. for (i=0; i<255;i++) {
  15. printf(" %d => %d\r\n",i,checkParity( i ) );
  16. }
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
 0 => 0
 1 => 1
 2 => 1
 3 => 0
 4 => 1
 5 => 0
 6 => 0
 7 => 1
 8 => 1
 9 => 0
 10 => 0
 11 => 1
 12 => 0
 13 => 1
 14 => 1
 15 => 0
 16 => 1
 17 => 0
 18 => 0
 19 => 1
 20 => 0
 21 => 1
 22 => 1
 23 => 0
 24 => 0
 25 => 1
 26 => 1
 27 => 0
 28 => 1
 29 => 0
 30 => 0
 31 => 1
 32 => 1
 33 => 0
 34 => 0
 35 => 1
 36 => 0
 37 => 1
 38 => 1
 39 => 0
 40 => 0
 41 => 1
 42 => 1
 43 => 0
 44 => 1
 45 => 0
 46 => 0
 47 => 1
 48 => 0
 49 => 1
 50 => 1
 51 => 0
 52 => 1
 53 => 0
 54 => 0
 55 => 1
 56 => 1
 57 => 0
 58 => 0
 59 => 1
 60 => 0
 61 => 1
 62 => 1
 63 => 0
 64 => 1
 65 => 0
 66 => 0
 67 => 1
 68 => 0
 69 => 1
 70 => 1
 71 => 0
 72 => 0
 73 => 1
 74 => 1
 75 => 0
 76 => 1
 77 => 0
 78 => 0
 79 => 1
 80 => 0
 81 => 1
 82 => 1
 83 => 0
 84 => 1
 85 => 0
 86 => 0
 87 => 1
 88 => 1
 89 => 0
 90 => 0
 91 => 1
 92 => 0
 93 => 1
 94 => 1
 95 => 0
 96 => 0
 97 => 1
 98 => 1
 99 => 0
 100 => 1
 101 => 0
 102 => 0
 103 => 1
 104 => 1
 105 => 0
 106 => 0
 107 => 1
 108 => 0
 109 => 1
 110 => 1
 111 => 0
 112 => 1
 113 => 0
 114 => 0
 115 => 1
 116 => 0
 117 => 1
 118 => 1
 119 => 0
 120 => 0
 121 => 1
 122 => 1
 123 => 0
 124 => 1
 125 => 0
 126 => 0
 127 => 1
 128 => 1
 129 => 0
 130 => 0
 131 => 1
 132 => 0
 133 => 1
 134 => 1
 135 => 0
 136 => 0
 137 => 1
 138 => 1
 139 => 0
 140 => 1
 141 => 0
 142 => 0
 143 => 1
 144 => 0
 145 => 1
 146 => 1
 147 => 0
 148 => 1
 149 => 0
 150 => 0
 151 => 1
 152 => 1
 153 => 0
 154 => 0
 155 => 1
 156 => 0
 157 => 1
 158 => 1
 159 => 0
 160 => 0
 161 => 1
 162 => 1
 163 => 0
 164 => 1
 165 => 0
 166 => 0
 167 => 1
 168 => 1
 169 => 0
 170 => 0
 171 => 1
 172 => 0
 173 => 1
 174 => 1
 175 => 0
 176 => 1
 177 => 0
 178 => 0
 179 => 1
 180 => 0
 181 => 1
 182 => 1
 183 => 0
 184 => 0
 185 => 1
 186 => 1
 187 => 0
 188 => 1
 189 => 0
 190 => 0
 191 => 1
 192 => 0
 193 => 1
 194 => 1
 195 => 0
 196 => 1
 197 => 0
 198 => 0
 199 => 1
 200 => 1
 201 => 0
 202 => 0
 203 => 1
 204 => 0
 205 => 1
 206 => 1
 207 => 0
 208 => 1
 209 => 0
 210 => 0
 211 => 1
 212 => 0
 213 => 1
 214 => 1
 215 => 0
 216 => 0
 217 => 1
 218 => 1
 219 => 0
 220 => 1
 221 => 0
 222 => 0
 223 => 1
 224 => 1
 225 => 0
 226 => 0
 227 => 1
 228 => 0
 229 => 1
 230 => 1
 231 => 0
 232 => 0
 233 => 1
 234 => 1
 235 => 0
 236 => 1
 237 => 0
 238 => 0
 239 => 1
 240 => 0
 241 => 1
 242 => 1
 243 => 0
 244 => 1
 245 => 0
 246 => 0
 247 => 1
 248 => 1
 249 => 0
 250 => 0
 251 => 1
 252 => 0
 253 => 1
 254 => 1