algos_and_structures/power_of_two/c/power.c
2024-11-02 14:03:30 +03:00

17 lines
No EOL
350 B
C

// Binary Search in C
#include <stdio.h>
int main(void)
{
int r = 0;
int test_array[] = {1,2,5};
int test_result[5];
int k = sizeof(test_array) / sizeof(test_array[0]);
for (int i = 1; i < k; i++) {
r = 10*r + test_array[i];
test_result[i]= r / 2;
r = r % 2;
printf("%d", test_result[i]);
}
}