init
This commit is contained in:
31
it_test.c
Normal file
31
it_test.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int i = 1;
|
||||
|
||||
int iterator() {
|
||||
i = i * 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
void print_binary(unsigned int num) {
|
||||
for (int i = sizeof(num) * 8 - 1; i >= 0; --i) {
|
||||
printf("%d", (num >> i) & 1);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main() {
|
||||
int run = 1;
|
||||
while (run) {
|
||||
int next = iterator();
|
||||
printf("Int: %d\n", next);
|
||||
printf("Bin: ");
|
||||
print_binary(next);
|
||||
// printf("Continue? [y]/n\n");
|
||||
// char c = scanf("%c", &c);
|
||||
// if (c == 'n') {
|
||||
// run = 0;
|
||||
// }
|
||||
run = next;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user