Tutorial Gateway

  • C
  • C#
  • Python
  • SQL
  • Java
  • JS
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs
  • MySQL

C log10 Function

The C log10 function is one of the C Math Functions, used to calculate the logarithmic value of a number with base 10. The syntax of the math log10 in C Programming is

double log10(double number);

C log10 Function Example

The math log10 Function allows you to find the logarithmic value of base 10. In this program, We are going to find the log10 value and display the output.

/* LOG10 in C Programming Example */

#include <stdio.h>
#include <math.h> 

int main()
{
    printf("\n The Logarithmic Value of 0 base 10      = %.4f ", log10(0));
    printf("\n The Logarithmic Value of 1 base 10      = %.4f ", log10(1));
    
    printf("\n The Logarithmic Value of 15 base 10     = %.4f ", log10(15));
    printf("\n The Logarithmic Value of 29.3 base 10   = %.4f ", log10(29.3));
    
    printf("\n The Logarithmic Value of -6.32 base 10  = %.4f ", log10(-6.32));  
    printf("\n The Logarithmic Value of -14.4 base 10  = %.4f ", log10(-14.4));
  
    return 0;
}
C log10 Function 1

C log10 Example 2

In this C Programming example, we are allowing the user to enter their own value. Next, the program uses the log10 function to find the logarithmic value of user given number with base 10.

/* LOG10 in C Programming Example */

#include <stdio.h>
#include <math.h>

int main()
{
    float number, logValue;

    printf(" Please Enter any Numeric Value :  ");
    scanf("%f", &number);
  
    logValue = log10(number);
  
    printf("\n Logarithmic Value of %.2f base 10 = %.4f ", number, logValue);
  
    return 0;
}
C log10 Function 2

Filed Under: C Programming

  • C Comments
  • C Escape Sequence
  • C Programming Operators
  • C Arithmetic Operators
  • C Assignment Operators
  • C Bitwise Operators
  • C Conditional Operator
  • C Increment & Decrement Optr
  • C Logical Operators
  • C Relational Operators
  • C Sizeof Operator
  • C If Statement
  • C IF ELSE Statement
  • C Else If Statement
  • C Nested If
  • C Break Statement
  • C Continue Statement
  • C Goto Statement
  • C Switch Case
  • C For Loop
  • C While Loop
  • C Do While Loop
  • C Arrays
  • C Two Dimensional Array
  • C Multi Dimensional Array
  • C String
  • C Structures
  • C Nested Structures
  • C Array of Structures
  • C Structures and Functions
  • C Union
  • C Structure & Union differences
  • C Pointers
  • C Pass Pointers to Functions
  • C GETS
  • C fgets Function
  • C fgetc
  • C fputs function
  • C fputc
  • C Functions
  • C Types of Functions
  • C Pass Array to Functions
  • Call By Value & Call By Reference
  • C Recursion
  • C Program Examples

Copyright © 2021· All Rights Reserved by Suresh.
About | Contact | Privacy Policy