bsc

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

root / semester_1 / tuition-c / P018.c

P018.c (729B)


      1 /* WAP to input the cost price and selling price and
      2 calculate profit, profit percentage, loss percentage or
      3 display the manage nither profit nor loss. */
      4 
      5 #include <stdio.h>
      6 int main()
      7 {
      8     double cost, sell, pro, prop, loss, lossp;
      9     printf("Enter the cost and selling price : ");
     10     scanf("%lf %lf", &cost, &sell);
     11     if (sell > cost)
     12     {
     13         pro = sell - cost;
     14         prop = (pro / cost) * 100;
     15         printf("Profit : RS %g, Profit Percentage : %g", pro, prop);
     16     }
     17     else if (sell < cost)
     18     {
     19         loss = cost - sell;
     20         lossp = (loss / cost) * 100;
     21         printf("Loss   : RS %g, Loss Percentage   : %g", loss, lossp);
     22     }
     23     else
     24         printf("Neither loss nor Profit.");
     25     return 0;
     26 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror