Rounding Floating Point Number To two Decimal Places in C
#include <stdio.h>
#include <math.h>
int main() {
float number, roundedNumber;
// Input the floating-point number
printf("Enter a floating-point number: ");
scanf("%f", &number);
// Round the number to two decimal places
roundedNumber = roundf(number * 100) / 100;
// Display the rounded number
printf("Rounded number to two decimal places: %.2f\n", roundedNumber);
return 0;
}