#include <stdio.h> int main() { int costPrice, sellingPrice; /* * Take costPrice and SellingPrice as input from user */ printf("Enter Cost Price and Selling Price\n"); scanf("%d %d", &costPrice, &sellingPrice); if(costPrice > sellingPrice) { /* Loss */ printf("Seller Loss = %d\n", costPrice - sellingPrice); } else if(sellingPrice > costPrice) { /* Profit or Gain*/ printf("Seller Profit = %d\n", sellingPrice - costPrice); } else { /* No Profit or Loss*/ printf("No Profit and No Loss\n"); } return 0; }
Output:
Enter Cost Price and Selling Price 5 10 Profit = 5