Write a program to accept cost price and selling price of an article. Calculate and print profit and loss after checking the condition. [15]
Your answer
Back
Submit
Write a program to accept cost price and selling price of an article. Calculate and print profit and loss after checking the condition. [15]
Answers
Answered by
7
pls mark as the brainlest
Attachments:
Answered by
2
Answer:
Pls tell in which language? Java, c++ or python?
Explanation:
Here's your answer in c++ :
// C++ code to demonstrate Profit and Loss
#include <iostream>
using namespace std;
// Function to calculate Profit.
int Profit(int costPrice, int sellingPrice)
{
int profit = (sellingPrice - costPrice);
return profit;
}
// Function to calculate Loss.
int Loss(int costPrice, int sellingPrice)
{
int Loss = (costPrice - sellingPrice);
return Loss;
}
// Driver Code.
int main()
{
int costPrice = 1500, sellingPrice = 2000;
if (sellingPrice == costPrice)
cout << "No profit nor Loss";
else if (sellingPrice > costPrice)
cout << Profit(costPrice, sellingPrice) << " Profit ";
else
cout << Loss(costPrice, sellingPrice) << " Loss ";
return 0;
}
HOPE IT HELPS. PLS MARK ME BRAINLIEST ☺️
Similar questions