Question #286619

Decimal x Decimal

by CodeChum Admin

Now that we're done with integers, we're moving on to decimals!


Instructions:

  1. Input three decimal numbers in one line separated by spaces, and make sure to store them in different variables.
  2. Multiply the 1st and 2nd decimal numbers, and store the product into a variable.
  3. Then, divide the product of the 1st and 2nd decimal numbers with the 3rd decimal number, then print out its quotient.

Input


1. First decimal number

2. Second decimal number

3. Third decimal number

Output


The first three lines will contain message prompts to input the three decimal numbers.

The last line contains the result in two decimal places.


Enter·the·first·number:·1.53

Enter·the·second·number:·2.25

Enter·the·third·number:·1.23

Result·=·2.80




Expert's answer





#include <stdio.h>
#include <string.h>
#include <ctype.h>




int main(){
	float number1,number2,number3,product,quotient;




	printf("Enter the first number: ");
	scanf("%f",&number1);
	printf("Enter the second number: ");
	scanf("%f",&number2);
	printf("Enter the third number: ");
	scanf("%f",&number3);
	product=number1*number2;
	quotient=product/number3;
	printf("Result = %.2f\n",quotient);




	getchar();
	getchar();
	return 0;
}

LATEST TUTORIALS
APPROVED BY CLIENTS