A pharmacy has multiple brands of COVID self-test kits. Customers are allowed to purchase multiple brands. Given n as the number of COVID self-test kit brands and m as the stock available in each brand. The m value varies for each brand.
Customers can purchase self-test kits for each brand. Suppose if a customer asks for a number of self-test kits more than the stock m, then the pharmacy sells only m kits. Write a C program using structures with data members as brand_name and available_stock to sell self-test kits until the stock gets over and print the brand_name and the average number of kits (Ex: 15/4 = 3.75; 10/3 = 3.33; 10/2 = 5.00) in each brand that were distributed. Print only 2 decimal places of average.
Example:
Input Format:
The first line contains an integer n, the number of brands.
The second line contains the brand_name.
The third line contains the stock availability as an integer.
Followed by the number of kits brought by each customer, and this repeats until n.
Output Format:
Display the brand_name and the average number of kits distributed for each brand.