Chapter 2 – Q #13: Circuit Board Price – Tony Gaddis – Starting Out With C++
Problem: -
An electronics company sells circuit boards at a 40 percent pro t. Write a program that will calculate the selling price of a circuit board that costs $12.67. Display the result on the screen.
Solution: -
#include <iostream>
using namespace std;
int main()
{
const float circuit_price = 12.67;
float profit = (40 / 100.0) * circuit_price;
float selling_price = 0.0;
selling_price = circuit_price + profit;
cout << "Selling Price OF Circuit Board is " << selling_price;
return 0;
}
This is the solution of this question
OUTPUT OF THIS QUESTION
Explanation of this Solution
- I declared a float data type constant and initialize given value.
- I declared another variable named profit and calculate profit.
- I declared a float data type variable named selling price.
- Then, calculate price and store in total selling price variable.
- In last, display output of distance on the screen.
- Return 0 to the main function.
Also, I attach CPP file of this problem. You can download this file
0 Comments