If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.

#include<stdio.h>
 int main()
    {
      float  C, S;
      printf("Enter cost price of the product: ");
      scanf( "%f" ,&C);
      printf("\nEnter selling price of thr products: ");
      scanf("%f",&S);
      if(S>C)
         printf("\nSeller has made profit.\nProfit= %.3f",S-C);
      else
          printf("\nSeller has incurred loss.\nLose= %.3f",C-S);
      return  0;
    }

3 comments: