Nearbyint Function


It returns the value of number rounded to the nearest integer .

Syntax:

float nearbyintf(float arg);

double nearbyint(double arg);

long double nearbyintl(long double arg);

Example:

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

  int main()
    {
     printf("Value of nearest integer: %f.", nearbyint(1.4));
     printf("\nValue of nearest integer: %f.", nearbyint(2.8));     

  return 0;]
  }
   
Back