Showing posts with label C.Round function. Show all posts
Showing posts with label C.Round function. Show all posts

Round function

round() function is used to get the nearest integer value of any float argument passed through this function.if the number after point is between "1 to 5" then it will return less than argument.and if the number after point is between "6 to 9" then it will return greater than argument.this function is included in math.h library,therefore
we have to add "#include<math.h>".Let us see syntax:

SYNTAX:

round(float variable);

EXAMPLE:

#include<stdio.h>
#include<conio.h>
#include<main.h>
int main()
{
       float a=9.4,b=8.9;
       clrscr();
       printf("round is %f\n",round(a));
   printf("round is %f\n",round(b));
       getch();
}