C Program to Multiply Two Floating-Point Numbers
C Program to Multiply Two Floating-Point Numbers
  • Post author:
  • Reading time:1 mins read
  • Post category:C Programs

In this programming example, you will learn how to multiply two floating-point numbers using c programming.

In this programming example, you will read two floating-point numbers from the user, multiply them then print the result onto the console.

In order to understand the example, you must have some knowledge of c programming pre-requisites:


C Program to Multiply Two Numbers

#include<stdio.h>
int main()
{
 float number1,number2,result;
 printf("\n\nEnter Two Floating Point Numbers to Multiply Them:\n");
 scanf("%f%f",&number1,&number2);
 result=number1*number2;
 printf("\nResult is: %f\n\n",result);
 return 0;
}
Enter Two Floating Point Numbers to Multiply Them:
10.1
11.1
Result is: 112.110008
Output-C Program to Multiply Two Floating-Point Numbers.webp

Code Explanation

In the above program, the user is asked to enter two floating numbers. Tho floating numbers are read using scanf and stored on number1 and number2 respectively.

Using * operator the product of number1 and number2 is calculated and stored in the result variable.

Print the result onto the console.