Calculate profit and loss

PHOTO EMBED

Mon Apr 22 2024 19:40:54 GMT+0000 (Coordinated Universal Time)

Saved by @Amlan #c

#include <stdio.h>

int main() {
    
    float cp,sp;
    
    printf("Enter The Cost Price : ");
    scanf("%f",&cp);
    
    printf("Enter The Selling Price : ");
    scanf("%f",&sp);
    
    float p,l;
    p=(sp-cp);
    l=(cp-sp);
    
    if(cp>sp){
        printf("\nLoss = %f",l);
    }
    if(sp>cp){
        printf("\nProfit = %f ",p);
    }
   if(sp==cp){
        printf("\nNo Loss , No Profit");
    }
    return 0;
}
content_copyCOPY