C Program to Multiply two Floating Point Numbers
Last Updated :
07 Aug, 2023
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
#include <stdio.h>
float multiply( float a, float b)
{
return a * b;
}
int main()
{
float A = 2.12, B = 3.88, product;
product = multiply(A, B);
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.
Share your thoughts in the comments
Please Login to comment...