C Program to Multiply two Floating Point Numbers

Problem

Write a program in C to multiply two floating point numbers and then display the output on the console window.

C Program to Multiply two Floating Point Numbers

#include <stdio.h>
int main()
{
    double input1, input2, output;
    printf("Enter two numbers: ");

    // Abundantcode - Stores the values entered by the user in the input1 and input2
    scanf("%%lf %%lf", &input1, &input2);  
 
    // multiply the two numbers and store the result in output
    output = input1 * input2;  

    // Result up to 2 decimal point is displayed using %%.2lf
    printf("Product = %%.2lf", output);
    
    return 0;
}

Output

Enter two numbers: 6 7                                                                                                                                                       
Product = 42.00