C trunc() Function

Last Updated:

C trunc()

The trunc() function returns the integer part of the number x, removing any fractional digits.

This function is defined in <math.h> header file.

Example

C Compiler
#include <stdio.h> #include <math.h> int main() { printf("%d", (int) trunc(619.76)); return 0; }

Syntax

trunc(x)

Parameter Values

ValueTypeExplanation
x Required Specifies a number.

Return Value

ValueExplanation
Number Returns the integer part of the number x, removing any fractional digits.

Share this Page

Meet the Author