Computer Science, asked by evanslee8181, 5 months ago

write an algorithm to this problem:ramshewak goes to market for buying some fruits and vegetables.he is having a currency of Rs 500 with for marketing. from a shop he purchases 2.0 kg Apple priced Rs.50.0 per kg, 1.5 kg mango priced Rs.35.0 per kg, 2.5 kg potato priced Rs.10 er kg, and 1.0 kg Tomato priced Rs. 15 per kg. he gives the currency of Rs. 500 to the shopkeeper. find out the amount shopkeeper will return to ramshewak and also tell the total item purchased

Answers

Answered by muhggg66
25

Answer:

Inputs to the algorithm are:

1. amount of different items purchase, for example 2.0 kg Apple etc.

2. price of the items, for example Mango is Rs. 35.0 per kg

3. total amount given to the shopkeeper

Expected output:

Amount to be returned by shopkeeper after deducting total price of the purchased

vegetables and fruits, and total items purchased.

Algorithm:

Step1: Total  0, i  1;

8

Algorithm and Flow Chart Spet2: Read amount purchased and unit price of itemi

Step3: Total Total + amount of itemi* price per unit of itemi

Step4: i i+1

Step5: Repeat Step 2 to 4 for each purchased item

Step6: Read Total amount given to the shopkeeper as GivenAmount

Step7: RefundAmount  GivenAmountTotal

Step8: Print amount to be refund is Rs.: RefundAmount

Step9: Print total item purchased are: i

Explanation:

Similar questions