text: Program to compute log a to any base b ( logb a ) | C program to find log ( a ) on any base b ; Driver code
code: #include <math.h> NEW_LINE #include <stdio.h> NEW_LINE int log_a_to_base_b ( int a , int b ) { return log ( a ) / log ( b ) ; } int main ( ) { int a = 3 ; int b = 2 ; printf ( " % d STRNEWLINE " , log_a_to_base_b ( a , b ) ) ; a = 256 ; b = 4 ; printf ( " % d STRNEWLINE " , log_a_to_base_b ( a , b ) ) ; return 0 ; }