Search
 
SCRIPT & CODE EXAMPLE
 

C

round decimal point in C

#include <math.h>

float val = 37.777779;

float rounded_down = floorf(val * 100) / 100;   /* Result: 37.77 */
float nearest = roundf(val * 100) / 100;  /* Result: 37.78 */
float rounded_up = ceilf(val * 100) / 100;      /* Result: 37.78 */
Comment

PREVIOUS NEXT
Code Example
C :: mongo script to find collection size in database 
C :: print float in c 
C :: how to empty array in c 
C :: c median of array 
C :: pop and push shows black screen which needs to be pressed back flutter 
C :: how to return array of char in c 
C :: FCFS algorithm in c to find average turnaround time and waiting time 
C :: ecrire programme en C une fonction remplir tableau et un fonction inverser 
C :: how to change file permissions in C language 
C :: esp8266 wifi.config does not work 
C :: how to input till end of line in c 
C :: how to arrange a 2d array based on string length in c 
C :: command args c 
C :: function that changes all lowercase letters of a string to uppercase. 
C :: round c 
C :: c defined value sum 
C :: Example of read and write project in c 
C :: ecto where is not nil 
C :: git add -u flag 
C :: Here is a program in C that illustrates the use of fprintf() to write a text file: 
C :: run steam as root 
C :: grep C hello world 
C :: konami code hdl 
C :: how to output in green in c 
C :: python project script run 
C :: which one is faster loop or recursive function? 
C :: read from text file in c 
C :: Example of header file c 
C :: Wait until an animation finishes - Selenium, Java 
C :: To get file info 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =