scanf()
function and stored in the variables a
and b
. a
and b
are multiplied using the arithmetic operator *
and the product is stored in the variable product.#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;
}
Enter two numbers: 3.7
4.3
Product = 15.91