কম্পিউটার টিউটোরিয়াল

C++-এ বিক্রয় মূল্য (Selling Price) এবং লাভ/লস শতাংশ দিয়ে ক্রয় মূল্য (Cost Price) নির্ণয়


বিক্রয় মূল্য এবং লাভ বা লসের শতাংশ দেওয়া থাকলে পণ্যের ক্রয় মূল্য বের করতে হবে। সূত্রগুলো নিচের মতো:

$$Cost \: Price = \frac{Sell Price \times 100}{100 + Percentage \: Profit}$$

$$Cost \: Price = \frac{Sell Price \times 100}{100 - Percentage \: Loss}$$

উদাহরণ

#include<iostream> using namespace std; float priceWhenProfit(int sellPrice, int profit) {    return (sellPrice * 100.0) / (100 + profit); } float priceWhenLoss(int sellPrice, int loss) {    return (sellPrice * 100.0) / (100 - loss); } int main() {    int SP, profit, loss;    SP = 1020;    profit = 20;    cout << "Cost Price When Profit: " << priceWhenProfit(SP, profit) << endl;    SP = 900;    loss = 10;    cout << "Cost Price When loss: " << priceWhenLoss(SP, loss) << endl; }

আউটপুট

Cost Price When Profit: 850 Cost Price When loss: 1000

  1. বাইনারি ট্রিতে রুট থেকে নির্দিষ্ট নোডের দূরত্ব বের করা C++-তে

  2. দেওয়া পরিসীমা এবং ক্ষেত্রফল থেকে ঘনবস্তুর সর্বোচ্চ আয়তন বের করা C++-তে

  3. সি++ প্রোগ্রাম: দেওয়া শর্ত পূরণকারী a এবং b সংখ্যা খুঁজে বের করা

  4. C++-এ দিয়ে गये GCD এবং LCM থেকে যেকোনো পেয়ার খুঁজে বের করা