Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Reads two real numbers from the keyboard and prints their product. Sample progra

ID: 3886081 • Letter: R

Question

Reads two real numbers from the keyboard and prints their product. Sample program: #include int main() { int a, b: /* to declare that a and b are integer variables */ printf("Enter two integer numbers separated by space ="): scanf("%d %d", &a;, &b;): /* this is the way to read two integer numbers and assigned them to a and b */ printf("The sum of the two numbers is %d. ", a+b): /* %d is for integer format*/ return 0: } Use int for integers, floatfor floating (real) numbers. To enter the value of a variable from the keyboard (standard input), usescanf(). The scanf function reads input from the keyboard in the format specified by (%d %d) and assigns each value to the variable followed. Use %d for integer and %ffor float. Add an ampersand (&) before each variable when using the scanf function for a reason too early to discuss. The printf function prints a string to the screen (standard output). When it encounters a format (such as %d), it replaces that part by the variable followed.

Explanation / Answer

#include <stdio.h>

int main()
{
float f1,f2;
  
printf("Enter two real number separated by space: ");
scanf("%f %f ", &f1,&f2);
printf("The product of two float numbers is %f ", (f1*f2));

return 0;
}

Output: