Lab Task 4 Os
Lab Task 4 Os
NO 1: CODE IN C LANGUAGE
This C program snippet demonstrates the multiplication of two floating-point numbers and
displays the result.
1. float num1, num2, product;: Declares three floating-point variables: num1 and num2
to store the input numbers, and product to store the result of their multiplication.
2. scanf("%f", &num1);: Prompts the user to input the first number and stores it in num1.
3. scanf("%f", &num2);: Prompts the user to input the second number and stores it in
num2.
4. product = num1 * num2;: Multiplies the values of num1 and num2 and stores the result
in the product variable.
5. printf("The product of %.2f and %.2f is %.2f\n", num1, num2, product);:
Prints the two input numbers and their product, formatted to two decimal places, in the
format:
6. The product of <num1> and <num2> is <product>