Computer Science, asked by Harishkrishna6859, 1 year ago

Write a program to input cost price and selling price of a product and check profit or loss. Also calculate total profit or loss.

Answers

Answered by sailorking
4

The programming is done C++ language:-

# include <iostream.h>

# include <conio.h>

void main()

{

   clrscr ( );

   int a , b , profit_loss ;

   cout << " Enter the cost price of the product " ;

   cin >> a ;

   cout << " Enter the selling price of the product " ;

   cin >> b ;

    profit_loss = b - a ;

    if( profit_loss > 0 )

     {

          cout << " Profit = " << profit_loss ;

      }

      else

       {

           cout << " Loss = " << profit_loss ;

       }

       getch ( ) ;

}

Similar questions