Google News
logo
C Program to Multiply Two Floating-Point Numbers
The below program to multiply two floating point numbers, the user is first asked to enter two floating numbers and the input is scanned using the scanf() function and stored in the variables a  and b.

Then, the variables a and b  are multiplied using the arithmetic operator *  and the product is stored in the variable product.
Program :
#include <stdio.h>
int main() {
    double a, b, product;
    printf("Enter two numbers: ");
    scanf("%lf %lf", &a, &b);  
 
    // Calculating product
    product = a * b;

    // %.2lf displays number up to 2 decimal point
    printf("Product = %.2lf", product);
    
    return 0;
}
Output :
Enter two numbers: 3.7
4.3
Product = 15.91