Write a python program that accepts cost of goods sold revenue generated, operating costs and prints gross profit, net profit and net profit percentage.
Answers
// C++ implementation to find Cost price
#include <iostream>
using namespace std;
// Function to calculate cost price with profit
float CPwithProfit(int sellingPrice, int profit)
{
float costPrice;
// required formula to calculate CP with profit
costPrice = (sellingPrice * 100.0) / (100 + profit);
return costPrice;
}
// Function to calculate cost price with loss
float CPwithLoss(int sellingPrice, int loss)
{
float costPrice;
// required formula to calculate CP with loss
costPrice = (sellingPrice * 100.0) / (100 - loss);
return costPrice;
}
// Driver code
int main()
{
int SP, profit, loss;
SP = 1020;
profit = 20;
cout << "Cost Price = " << CPwithProfit(SP, profit) << endl;
SP = 900;
loss = 10;
cout << "Cost Price = " << CPwithLoss(SP, loss) << endl;
SP = 42039;
profit = 8;
cout << "Cost Price = " << CPwithProfit(SP, profit) << endl;
return 0;
}
# Code
cgos = int(input('Enter cost of goods sold : '))
rg = int(input('Enter revenue generated : '))
oc = int(input('Enter operating cost : '))
gp = rg - cogs # Gross profit
np = gp - oc # Net profit
npp = np/rg*100 # Net profit percentage
print('Gross profit is', gp)
print('Net profit is', np)
print('Net profit percentage is', npp)