17 lines
No EOL
350 B
C
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]);
|
|
}
|
|
} |