Program to calculate Profit Or Loss | C ++ code to demonstrate Profit and Loss ; Function to calculate Profit . ; Function to calculate Loss . ; Driver Code .
#include <iostream> NEW_LINE using namespace std ; int Profit ( int costPrice , int sellingPrice ) { int profit = ( sellingPrice - costPrice ) ; return profit ; } int Loss ( int costPrice , int sellingPrice ) { int Loss = ( costPrice - sellingPrice ) ; return Loss ; } 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 ; }