মুনাফা খোঁজার সূত্রটি নিম্নরূপ যদি বিক্রয় মূল্য ব্যয় মূল্যের চেয়ে বেশি হয় -
profit=sellingPrice-CosePrice;
যদি খরচ মূল্য বিক্রয় মূল্যের চেয়ে বেশি হয় -
ক্ষতি খোঁজার সূত্রটি নিম্নরূপloss=CostPrice-SellingPrice
এখন, এই যুক্তিটি প্রোগ্রামে প্রয়োগ করুন এবং খুঁজে বের করার চেষ্টা করুন যে কোনও নিবন্ধ কেনার পরে ব্যক্তিটি লাভ বা ক্ষতি পায় কিনা −
উদাহরণ
লাভ বা ক্ষতি −
খুঁজে বের করার জন্য C প্রোগ্রামটি নিচে দেওয়া হল#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