- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program to find the Discount Percentage in C++

In this problem, we are given two numbers that define the marked price(M) and selling price(S) of a certain product. Our task is to create a *program to
find the Discount Percentage in C++*.

**Discount** is the amount that is deducted from the actual price (marked price) on a product.

The formula for discount is,

discount = marked price - selling price

**Discount percentage** is the percentage of the price that is deducted from the actual price of the product.

The formula for discount percentage is,

discount percentage = (discount / marked price ) * 100

**Let’s take an example to understand the problem,**

## Input

240, 180

## Output

25%

## Explanation

Discount = (240 - 180) = 60 Discount percentage = (60/240)*100 = 25%

## Solution Approach

The formulas for discount and discount percentage are −

Discount = marked price - selling price Discount percentage = (discount / marked price ) * 100

**Program to illustrate the working of our solution,**

## Example

#include <iostream> using namespace std; int main() { float MP = 130, SP = 120; float DP = (float)(((MP - SP) * 100) / MP); printf("The discount percentage on the given product is %.2f\n", DP); return 0; }

## Output

The discount percentage on the given product is 7.69

- Related Questions & Answers
- Java program to calculate the percentage
- Program to find Final Prices With a Special Discount in a Shop in Python
- C++ program to find the rate percentage from compound interest of consecutive years
- Find percentage from marks in MySQL
- Java program to find the percentage of uppercase, lowercase, digits and special characters in a String
- Program to find the percentage of places where knight can move and not left the board in Python
- What are pure discount bonds?
- How to find the percentage of missing values in an R data frame?
- Apply Discount Every n Orders in C++
- How to find the percentage of each category in an R data frame column?
- Write the difference between discount rate and interest rate.
- How to find the percentage of each category in a data.table object column in R?
- How to find the percentage of zeros in each column of a matrix in R?
- How to find the percentage of zeros in each column of a data.table object in R?
- How to find the percentage of zeros in each column of a data frame in R?

Advertisements