Assuming that the user inputs a value of 25 for the price an

Assuming that the user inputs a value of 25 for the price and 10 for the discount rate in the following code snippet, what is the output?

int main()

{

   cout << \"Enter the price: \";

   double price;

   cin >> price;

   cout << \"Enter the discount rate: \";

   double discount;

   cin >> discount;

   cout << \"The new price is \";

   cout << price - price * (discount / 100.0) << endl;

   return 0;

Solution

Program:

#include <iostream>

using namespace std;

int main()
{
cout << \"Enter the price: \";
double price;
cin >> price;

cout << \"Enter the discount rate: \";
double discount;
cin >> discount;

cout << \"The new price is \";
cout << price - price * (discount / 100.0) << endl;
return 0;
}

Output:

Enter the price: 25

Enter the discount rate: 10

The new price is 22.5

Assuming that the user inputs a value of 25 for the price and 10 for the discount rate in the following code snippet, what is the output? int main() { cout <

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site