Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to force decimal integers in C language?
How to force decimal integers in C language?
Forced decimal integers can refer to the following codes in C language:

1. Use the floor function.

Floor(x) returns the largest integer less than or equal to x. For example:

Floor (2.5) = 2

Lower limit (-2.5) = -3

2. Use the ceil function.

Ceil(x) returns the smallest integer greater than x. For example:

Upper limit (2.5) = 3

Upper limit (-2.5) = -2

Extended data:

Some reference functions of C language;

Int getche () reads a character from the console (keyboard) and displays it on the screen.

int? Ungetch(int c) returns the character c to the console (keyboard).

Long labs(long n) returns the absolute value of the long integer parameter n.

Void perror(char *string) This function will display the latest error message in the following format: String: error message.

Baidu encyclopedia -C language function