bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

P018.c (865B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* WAP to input the cost price and selling price and
      8 calculate profit, profit percentage, loss percentage or
      9 display the manage nither profit nor loss. */
     10 
     11 #include <stdio.h>
     12 int main()
     13 {
     14     double cost, sell, pro, prop, loss, lossp;
     15     printf("Enter the cost and selling price : ");
     16     scanf("%lf %lf", &cost, &sell);
     17     if (sell > cost)
     18     {
     19         pro = sell - cost;
     20         prop = (pro / cost) * 100;
     21         printf("Profit : RS %g, Profit Percentage : %g", pro, prop);
     22     }
     23     else if (sell < cost)
     24     {
     25         loss = cost - sell;
     26         lossp = (loss / cost) * 100;
     27         printf("Loss   : RS %g, Loss Percentage   : %g", loss, lossp);
     28     }
     29     else
     30         printf("Neither loss nor Profit.");
     31     return 0;
     32 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror