Calculations

Multiplication of two floating point numbers in C

Multiplication of two floating point numbers in C

In this tutorial, we will discuss the concept of Multiplication of two floating point numbers in C

In this topic, we are going to learn how to multiply two floating-point numbers using the multiplication operator in C language

Multiply of two floating-point numbers

What is multiplication

The multiplication is a method of combining a group of equal size. The multiplication is an arithmetic operation inverse of division

It is one of the four basic operation of arithmetic calculation others being addition,subtraction,division

The product of two  numbers means, it is the operation one number is combining within another using multiply(*) operator.

 

The answer of a multiplication operation is called as “product”

 

Find product of two floating point numbers in C

Program to product of two floating point  numbers

The program  calculates the product of the given floating-point numbers using “*” operator

Program 1

#include <stdio.h>
#include <stdlib.h>

int main()
{
    double num1=2.2,num2=5.0,product;
//Declare and initialize double variables
    product=num1*num2;
//Calculate the product
    printf("product of %.1f and %.1f is=%.2lf",num1,num2,product);
//Display the result on the screen
getch();
    return 0;
}

When the above code is executed, it produces the following result

product of 2.2 and 5.9 is=11.00

 

Program to product of two floating point numbers – Takes input from user

The program allows the user to enter two floating-point numbers and then it calculates the product of the given numbers using multiplication operator

Program 2

#include <stdio.h>
#include <stdlib.h>

int main()
{
    double num1,num2,product;
//Declare double variables
    printf("Enter two float numbers: ");
//ask input from the user
    scanf("%lf %lf",&num1,&num2);
//store the input in the variables num1,num2 
    product=num1*num2;
//Calculate the product
    printf("product of %.1f and %.1f is=%.2lf",num1,num2,product);
//Display the result on the screen
    getch();
    return 0;
}

When the above code is executed, it produces the following result

Enter two float numbers:3.5
5.5
product of  3.5 and 5.5 is=19.25

 

Suggested for you

Operator in C language

Data types in C language

Variables in C language

 

Similar post

Find product of two numbers using function in C language

Find product of two numbers using recursion in C language

Find product of two numbers using pointer in C language

 

Multiply two numbers in C++ language

Multiply two numbers in Python language

Multiply two numbers in Java language

 

Multiply of two floating-point numbers in Java

Multiply of two floating-point numbers in C

Multiply of two floating-point numbers in C++

Multiply of two floating-point numbers in Python

 

Program to multiply of two floating-point numbers in Java
Find product of two floating point numbers in C++
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

2 days ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago