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 }