Write a Program that accept sale price and cost price and find the profit and loss.



#include<conio.h>                                                                                 
#include<stdio.h>
void main()
{
  float sale,cost,profit,loss; //Data type may be change as required
  printf("Enter the sale prize = ");
  scanf("%f",&sale);
  printf("Enter the cost prize = ");
  scanf("%f",&cost);
  profit=sale-cost;
  loss=cost-sale;
  if(profit>loss)
  {
    printf("Profit is = %f",profit);
  }
  else
  {
   printf("Loss is %f",loss);
  }
getch();
}
  
OUTPUT :-
 
Previous Post
Next Post