C Program to Multiply Two Floating-Point Numbers

Code of the program

#include <stdio.h>
int main() {
    double a, b, product;
    printf("Enter two numbers: ");
    scanf("%lf %lf", &a, &b);  
 
    // Calculating product
    product = a * b;
    // Result up to 2 decimal point is displayed using %.2lf
    printf("Product = %.2lf", product);
    
    return 0;
}

Output

Insert two numbers: 2.4
1.12
Product = 2.69

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *