Given the Cost Price(CP) and Selling Price(SP) of a product. The task is to Calculate the Profit or Loss.
Input: CP = 1500, SP = 2000 Output: 500 Profit Input: CP = 3125, SP = 1125 Output: 2000 Loss
Profit = (Selling Price - Cost Price) Loss = (Cost Price - Selling Price)
Below is the required implementation:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Loss when two items are sold at same price and same percentage profit/loss
- Program to find the profit or loss when CP of N items is equal to SP of M items
- Find cost price from given selling price and profit or loss percentage
- Calculate the loss incurred in selling the given items at discounted price
- Program to calculate the profit sharing ratio
- ML | Common Loss Functions
- Maximum profit by buying and selling a share at most k times
- Maximum profit after buying and selling the stocks
- Find Selling Price from given Profit Percentage and Cost
- Maximize profit when divisibility by two numbers have associated profits
- Maximum profit such that total stolen value is less than K to get bonus
- Maximum profit by buying and selling a share at most K times | Greedy Approach
- Maximum profit by buying and selling a share at most twice
- Efficient program to calculate e^x
- C program to calculate the value of nPr
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Program to calculate the number of odd days in given number of years
- Program to Calculate Body Mass Index (BMI)
- Program to calculate distance between two points
- Program to calculate volume of Ellipsoid
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.