161k views
5 votes
Write an algorithm for the following problem. Mfon is at the market to purchase some fruits and vegetables. He has 500 ngn with him. He buys the following items ; 2kg of apple at 50ngn/kg, 1.5kg of mangoes at 35ngn/kg, 2.5kg potatoes at 10ngn/kg, 1.0kg tomatoes at 15ngn/kg ; write the algorithm pointing out mfon's change and the total number of items he purchased.

User JimmyJames
by
8.0k points

1 Answer

4 votes

Final answer:

To calculate Mfon's change and the total number of items he purchased at the market, we need to determine the cost of each item and subtract it from the initial amount of money he had. The change will be the difference between the initial amount and the total cost.

Step-by-step explanation:

To solve this problem, we need to calculate the total cost of the items Mfon purchased and subtract it from the amount he had initially. Let's start by calculating the cost of each item:

  • 2kg of apples at 50NGN/kg: 2kg * 50NGN/kg = 100NGN
  • 1.5kg of mangoes at 35NGN/kg: 1.5kg * 35NGN/kg = 52.5NGN
  • 2.5kg of potatoes at 10NGN/kg: 2.5kg * 10NGN/kg = 25NGN
  • 1.0kg of tomatoes at 15NGN/kg: 1.0kg * 15NGN/kg = 15NGN

Now, let's calculate the total cost:

Total cost = 100NGN + 52.5NGN + 25NGN + 15NGN = 192.5NGN

Next, we can calculate Mfon's change:

Change = Initial amount - Total cost = 500NGN - 192.5NGN = 307.5NGN

Therefore, Mfon's change is 307.5NGN and he purchased a total of 4 items.

User AnupamChugh
by
8.1k points