Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- internal class Program
- {
- static void Main(string[] args)
- {
- Queue<int> buyers = new Queue<int>();
- int sumPurchase = 0;
- int minPurchase = 100;
- int maxPurchase = 10000;
- int minBuyers = 1;
- int maxBuyers = 11;
- int countBuyers = ReturnRandomNumber(minBuyers, maxBuyers);
- for (int i = 0; i < countBuyers; i++)
- {
- buyers.Enqueue(ReturnRandomNumber(minPurchase, maxPurchase));
- }
- for (int i = 0; i < buyers.Count; i++)
- {
- sumPurchase += buyers.Dequeue();
- }
- Console.WriteLine($"Сегодня было {countBuyers} покупателей и они купили на {sumPurchase} рублей.");
- Console.ReadKey();
- }
- static int ReturnRandomNumber(int minNumber, int maxNumber)
- {
- Random random = new Random();
- int number = random.Next(minNumber, maxNumber);
- return number;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement