Accept the cost price and selling price from the keyboard. Find out if the seller has made profit or loss and display how much profit or loss has een made.


#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("Loss = %d\n", costPrice - sellingPrice);  
    } else if(sellingPrice > costPrice) {  
        /* Profit or Gain*/ 
        printf("Profit = %d\n", sellingPrice - costPrice);  
    } else {
     /* No Profit or Loss*/
        printf("No Profit and No Loss\n");  
    }  
   
    return 0;  
} 
Accept the cost price and selling price from the keyboard. Find out if the seller has made profit or loss and display how much profit or loss has een made. Accept the cost price and selling price from the keyboard. Find out if the seller has made profit or loss and display how much profit or loss has een made. Reviewed by on August 30, 2019 Rating: 5
Powered by Blogger.