판매 가격이 있고 이익 또는 손실 비율이 제공된다고 가정합니다. 우리는 제품의 원가를 찾아야 합니다. 공식은 아래와 같습니다 -
$$비용 \:가격 =\frac{판매 가격 * 100}{100 + 백분율 \:이익}$$
$$비용 \:가격 =\frac{판매 가격 *100}{100 + 비율\:손실}$$
예
#include<iostream>
using namespace std;
float priceWhenProfit(int sellPrice, int profit) {
return (sellPrice * 100.0) / (100 + profit);
}
float priceWhenLoss(int sellPrice, int loss) {
return (sellPrice * 100.0) / (100 - loss);
}
int main() {
int SP, profit, loss;
SP = 1020;
profit = 20;
cout << "Cost Price When Profit: " << priceWhenProfit(SP, profit) << endl;
SP = 900;
loss = 10;
cout << "Cost Price When loss: " << priceWhenLoss(SP, loss) << endl;
} 출력
Cost Price When Profit: 850 Cost Price When loss: 1000