Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
87 views

C Programming - Program To Multiply Two Floating Point Numbers

This C program asks the user to input two floating point numbers, multiplies them together, and displays the product. It uses scanf() to store the user-input numbers in num1 and num2, multiplies them with num1*num2 and stores the product in product, and prints out the final product value with printf().

Uploaded by

R-jayVenturillo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

C Programming - Program To Multiply Two Floating Point Numbers

This C program asks the user to input two floating point numbers, multiplies them together, and displays the product. It uses scanf() to store the user-input numbers in num1 and num2, multiplies them with num1*num2 and stores the product in product, and prints out the final product value with printf().

Uploaded by

R-jayVenturillo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

C Program to Multiply two Floating

Point Numbers
In this program, user is asked to enter two floating point numbers and this program will mulitply
these two numbers and display it.

Source Code
/*C program to multiply and display the product of two floating point numbers entered by
user. */

#include <stdio.h>
int main( )
{
float num1, num2, product;
printf("Enter two numbers: ");
scanf("%f %f",&num1,&num2);
/* Stores the two floating point numbers entered by
user in variable num1 and num2 respectively */
product=num1*num2; /* Performs multiplication and stores it */
printf("Product: %f",product);
return 0;
}
Output
Enter two numbers: 2.4
1.1
Sum: 2.640000
Explanation
In this program, user is asked to enter two floating point numbers. These two numbers entered by
user will be stored in variables num1 and num2 respectively. This is done using scanf(
) function. Then, * operator is used for multiplying variables and this value is stored in
variable product .

Then, the product is displayed and program is terminated.

You might also like