Floating point numbers are a way to represent real numbers with both whole parts and fractional parts. In this article, we will learn how to write a C program to find the product of two floating-point numbers.
The below image shows an example of floating point multiplication in C:

C Program To Multiply Two Floating-Point Numbers
The below C program multiplies two floating numbers using the multiplication operator ( * ).
// C program to multiply two
// floating point numbers
#include <stdio.h>
// Function to multiply floating point
// numbers
float multiply(float a, float b)
{
return a * b;
}
// Driver code
int main()
{
float A = 2.12, B = 3.88, product;
// Calling product function
product = multiply(A, B);
// Displaying result up to 3 decimal places.
printf("Product of entered numbers is:%.3f", product);
return 0;
}
Output
Product of entered numbers is:8.226
Complexity Analysis
- Time Complexity: O(1)
- Auxiliary Space: O(1)
Refer to the complete article Multiplying Floating Point Numbers for more details.