Multipling Floating Point Numbers in C

Multiplying two numbers is a simple task in C, but in this article, we are going to perform the multiplication of two floating point numbers. Floating point numbers are those numbers that represent real numbers with fractional components.

C Program To Multiply Floating Point Numbers

This is a simple C Program that illustrates how to multiply two floating point numbers.

Output

Multipling Floating Point Numbers in C

Explaination of Above C Program

  • #include <stdio.h> is a preprocessor that includes a standard input/output library required for input and output operations.
  • Declare three float variables num1, num2, and result.
  • Ask the user to enter two floating point numbers using printf() and scanf().
  • Perform the multiplication of two floating point numbers by using the ‘*’ operator and store the product in the result variable.
  • At the end print the result by using printf().

Note

  • Use “%f” format specifier with printf and scanf function for taking input of float number with scanf() and for printing float number with printf().

See Also

2 thoughts on “Multipling Floating Point Numbers in C”

Leave a Comment