## What is log10 in c programming?

log10 in c is a library function which is used to calculate common base10 logarithm value of a given number.

This function is defined in math.h header file.

### Prototype

`double log10(double m);`

### Parameters

log10 function takes double type value as input parameter.

### Return value

log10 function returns base10 logarithm value of given number.

## Example program for log10 in c

```
#include<stdio.h>
#include<math.h>
int main()
{
double i,res;
printf("\n\n\tEnter the double type number \n\t");
scanf("%lf",&i);
res=log10(i);
printf("\n\tThe logarithm value is %lf \n",res);
return 0;
}
```

While using gcc use below command to add math header.

`gcc file_name.c -lm`

### Code explanation

log10 function is called by passing the value which is inputted from user. Result is being stored in res variable.

Then print the result on to the console.

## Difference between log10 and log in c

log10 function is used to calculate the common base10 logarithm value of a given number. log in c is a library function that is used to calculate the logarithm value of a given number.

Prototypes are as follows

```
double log10(double m);
double log(double m);
```

log10( ) | log( ) |

Used to calculate common base10 logarithm value of given number. | Used to calculate logarithm value of a given number. |

`double log10(double m);` | `double log(double m);` |

## People also ask for

### What is log10 in c?

log10 in c is a library function that is used to calculate the common base10 logarithm value of a given number.