C Program to Multiply two Floating Point Numbers

June 5, 2021

Program to multiply two floating point numbers and display the product as output.

Example 1: Program to display the product of two float numbers

In this program, user is asked to enter two float numbers and the program stores the entered values into the variable num1 and num2. The program then multiplies entered numbers and display the product as output.

#include <stdio.h>
int main(){
   float num1, num2, product;
   printf("Enter first Number: ");
   scanf("%f", &num1);
   printf("Enter second Number: ");
   scanf("%f", &num2);

   //Multiply num1 and num2
   product = num1 * num2;

   // Displaying result up to 3 decimal places. 
   printf("Product of entered numbers is:%.3f", product);
   return 0;
}

Output:

Enter first Number: 12.761
Enter second Number: 89.23
Product of entered numbers is:1138.664

admin