Write a program (in pascal) for the purchase of goods in a store for a certain amount of money, not exceeding

Write a program (in pascal) for the purchase of goods in a store for a certain amount of money, not exceeding a specified amount of money. INPUT DATA: From the keyboard, the amount for which purchases are supposed to be made is entered. Then the price and quantity of item # 1, item # 2, etc. are entered. until the amount of money is used up.

program zz1;

var a, b, c, d: integer; // set variables of integer type

begin

write (‘enter the available amount of money’); // enter a number from the keyboard

read (a);

b: = 1;

while a> 0 do // organize the loop while there is money

begin

writeln (‘enter the price of item no.’, b, ‘and quantity’);

read (d, c); // enter the price and quantity of goods from the keyboard

a: = a – d * c; // decrease the amount of money

writeln (‘there is still money left =’, a); // see how much money is still there

b: = b + 1; // increase the item number

end;

writeln (‘the amount is exhausted’);

end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.