Archived
1
0
Fork 0
This repository has been archived on 2022-06-20. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_clang/data/bit_3.c

31 lines
475 B
C
Raw Normal View History

2022-03-03 18:59:11 +03:00
#include <stdio.h>
int main() {
FILE *input = fopen("bit_3.dat","r");
int nya;
char t;
fscanf(input, "%x\n", &nya);
fclose(input);
t = (nya >> 4) & 1;
t += ((nya >> 5) & 1) * 2;
FILE *output = fopen("bit_3.ans","w");
switch (t) {
case 3:
fprintf(output, "%s", "bk");
break;
case 2:
fprintf(output, "%s", "bw");
break;
case 1:
fprintf(output, "%s", "rd");
break;
case 0:
fprintf(output, "%s", "bn");
break;
}
fclose(output);
}