Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Threading;
- namespace BookOrders
- {
- class BookOrders
- {
- static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB");
- int orders = int.Parse(Console.ReadLine());
- int[] packets = new int[orders];
- int[] books = new int[orders];
- double[] prices = new double[orders];
- int[] discounts = new int[orders];
- double[] pricesNew = new double[orders];
- for (int i = 0; i < orders; i++)
- {
- packets[i] = int.Parse(Console.ReadLine());
- if (packets[i] < 10)
- {
- discounts[i] = 0;
- }
- else if (packets[i] >= 110)
- {
- discounts[i] = 15;
- }
- else
- {
- int temp = 5;
- for (int k = 10; k < 110; k+=10)
- {
- if (packets[i] >= k && packets[i] < k + 10)
- {
- discounts[i] = temp;
- break;
- }
- else
- {
- temp++;
- }
- }
- }
- books[i] = int.Parse(Console.ReadLine());
- prices[i] = double.Parse(Console.ReadLine());
- }
- for (int m = 0; m < orders; m++)
- {
- pricesNew[m] = (packets[m] * books[m] * prices[m]) - ((packets[m] * books[m] * prices[m]) * discounts[m]/100);
- }
- double totalSum = 0;
- foreach (var item in pricesNew)
- {
- totalSum+= item;
- }
- int totalBooks = 0;
- for (int z = 0; z < orders; z++)
- {
- totalBooks += packets[z] * books[z];
- }
- Console.WriteLine(totalBooks);
- Console.WriteLine(totalSum.ToString("F"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment