C Program To Calculate Profit Or Loss
C Program To Calculate Profit Or Loss
In this example, you will learn to Calculate Profit Or Loss
How Program Works ??
Profit = S.P - C.P
Loss = C.P - S.P
(Where S.P is Selling Price and C.P is Cost Price)
Code For "Calculate Profit Or Loss".
/* Author --> HARSH PATEL */
#include<stdio.h>
int main()
{
float Unit_Price, Sales_Amount, Amount;
printf("\nEnter the Actrual Product Cost : ");
scanf("%f", &Unit_Price);
printf("\nEnter the Sale Price (or Selling Price) : ");
scanf("%f", &Sales_Amount);
if (Sales_Amount > Unit_Price)
{
Amount = Sales_Amount - Unit_Price;
printf("\nProfit Amount = %.4f", Amount);
}
else if(Unit_Price > Sales_Amount)
{
Amount = Unit_Price - Sales_Amount;
printf("\nLoss Amount = %.4f", Amount);
}
else
printf("\nNo Profit No Loss!");
return 0;
}
Output-1
Enter the Actrual Product Cost : 2500
Enter the Sale Price (or Selling Price) : 2600
Profit Amount = 100.0000
Output-2
Enter the Actrual Product Cost : 100
Enter the Sale Price (or Selling Price) : 90
Loss Amount = 10.0000
Output-3
Enter the Actrual Product Cost : 350
Enter the Sale Price (or Selling Price) : 350
No Profit No Loss!
😊 Some Image Of Program To Calculate Profit Or Loss
- Now Program End Without Any Error.


