#include <math.h>
double round(double x);
float roundf(float x);
long double roundl(long double x);
#include <stdio.h>
#include <math.h>
int main()
{
float i=5.4, j=5.6;
printf("round of %f is %f
", i, round(i));
printf("round of %f is %f
", j, round(j));
return 0;
}
#include <stdio.h>
int main (){
float a;
printf("
Enter a real number here please: ");
scanf("%f",&a);
printf("
Printing Number with different precision: ");
printf("
Number default precision: %f", a);
printf("
Number in (0 d.p.): %.0f", a);
printf("
Number in (1 d.p.): %.1f", a);
printf("
Number in (2 d.p.): %.2f", a);
printf("
Number in (3 d.p.): %.3f", a);
printf("
Number in (3 d.p.): %.4f", a);
return 0;
}
float f = 0.5;
round(f);
Code Example |
---|
C :: stdio.h in c |
C :: c random array |
C :: how to open a website in c |
C :: C read a character |
C :: fractional knapsack problem in c |
C :: how to sort assending in c |
C :: sum average min max in c array |
C :: typedef in c |
C :: Hello world in C programming language |
C :: limit axis in one direction plt |
C :: .sh template |
C :: initialize array c |
C :: multiplication table in c |
C :: arduino sketch structure |
C :: ** in c |
C :: round float in c |
C :: c loop |
C :: enregistrement en c |
C :: c long to string |
C :: sh: tailwindcss: command not found |
C :: #0000ff |
C :: open with overwrite c |
C :: access 2d array with pointer c |
C :: getline function in c |
C :: open a file in from terminal |
C :: C program to calculate the sum of odd and even numbers |
C :: what does packing mean in c |
C :: promt user input C |
C :: c program boilerplate |
C :: how to find folders from a c program |