লাভ = বিক্রয় মূল্য - ক্রয় মূল্য (যদি বিক্রয় মূল্য > ক্রয় মূল্য)
লস = ক্রয় মূল্য - বিক্রয় মূল্য (যদি ক্রয় মূল্য > বিক্রয় মূল্য)
উদাহরণ প্রোগ্রাম
#include<stdio.h>
int main() {
float CostPrice, SellingPrice, Amount;
printf("\n Enter the product Cost : ");
scanf("%f", &CostPrice);
printf("\n Enter the Selling Price : ");
scanf("%f", &SellingPrice);
if (SellingPrice > CostPrice) {
Amount = SellingPrice - CostPrice;
printf("\n Profit Amount = %.4f", Amount);
} else if(CostPrice > SellingPrice) {
Amount = CostPrice - SellingPrice;
printf("\n Loss Amount = %.4f", Amount);
} else
printf("\n No Profit No Loss!");
return 0;
}
আউটপুট
Enter the Product Cost: 450 Enter the Selling Price: 475.8 Profit Amount = 25.8000