Input three decimal numbers in one line separated by spaces, and make sure to store them in different variables.
Multiply the 1st and 2nd decimal numbers, and store the product into a variable.
Then, divide the product of the 1st and 2nd decimal numbers with the 3rd decimal number, then print out its quotient, with 2 decimal places.
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
float a,b,c;
cout << "Input a decimal number: ";
cin >> a;
cout << "Input a decimal number: ";
cin >> b;
cout << "Input a decimal number: ";
cin >> c;
float d = a * b;
float e = d / c;
cout << fixed << setprecision(2) << e << endl;
return 0;
}
Comments
Leave a comment