fork download
  1. #include<stdio.h>
  2. int main(){
  3. float price,loss,profit;
  4. int mango;
  5. printf("Enter the price of a dozen mangoes" );
  6. scanf("%f",&price);
  7. printf("\nEnter the price at which 1 mango is being sold" );
  8. scanf("%d",&mango);
  9. int total=mango*12;
  10. if(total<price)
  11. {
  12. loss=price-total;
  13. printf("\nLoss : Rs. %.2f",loss);
  14. }
  15. else if(total>price)
  16. {
  17. profit=total-price;
  18. printf("\nProfit : Rs. %.2f",profit);
  19. }
  20. else if(total=price)
  21. {
  22. printf("\nNo profit nor loss");
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 9416KB
stdin
60.0
5
stdout
Enter the price of a dozen mangoes
Enter the price at which 1 mango is being sold
No profit nor loss