In this tutorial, we will learn about round function in C programming language
In the C Programming Language, the round() returns the nearest integer value of the float/double/argument passed to this function.
Syntax
The syntax of the round() in C language
double round (double x); float round(float x); long double round(long double x);
x is the parameter or argument of this function – x is a floating point value for find round value.
when a value for x is passed, this function returns the rounded value of x
In the C Programming Language, the required header file for the round() is
#include <math.h>
The following example explains the usage of c language round() function
#include <stdio.h> #include <math.h> int main() { //Define temporary variable float i=5.2,j=6.8; //calculate and display round value printf("round value of %f is: %f\n",i,round(i)); printf("round value of %f is: %f\n",j,round(j)); return 0; }
When the above program is compiled and run, it will produce the following result
round value of 5.200000 is: 5.000000
round value of 6.800000 is: 7.000000
Similar Functions
Other C programming language functions that are similar to the cosine function
suggested for you
User defined function in C language
Arithmetic functions in C Language
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…