The recursive part seems strange.
int loga(int x){ 
    if(x==1){
        return 0;
    } else {
        return (1+loga(x/2));
//             ^^^^^^^^^^^^^ Changed here
    } 
}
2
solved Can you help me to find the logical error with this C recursive function? [closed]