In this example, the product of two floating-point numbers entered by the user is calculated and printed on the screen.
To understand this example, you should have the knowledge of the following C programming topics:
C Variables, Constants and Literals
C Data Types
C Input Output (I/O)
C Programming Operators
Program to Multiply Two Numbers
#include <stdio.h>
int main() {
double a, b, product;
printf("Enter two numbers: ");
scanf("%lf %lf", &a, &b);
// Calculating product
product = a * b;
// %.2lf displays number up to 2 decimal point
printf("Product = %.2lf", product);
return 0;
}