Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ComputerFirm
- {
- class Program
- {
- public static void Main()
- {
- int models = int.Parse(Console.ReadLine());
- double sales = 0;
- double rating = 0;
- for (int i = 0; i < models; i++)
- {
- int currentModel = int.Parse(Console.ReadLine());
- int modelRating = currentModel % 10;
- double modelSales = (int)(currentModel / 10);
- if (modelRating == 2)
- {
- modelSales = 0;
- }
- else if (modelRating == 3)
- {
- modelSales /= 2;
- }
- else if (modelRating == 4)
- {
- modelSales *= 0.7;
- }
- else if (modelRating == 5)
- {
- modelSales *= 0.85;
- }
- sales += modelSales;
- rating += modelRating;
- }
- Console.WriteLine($"{ Math.Floor(sales):f2}");
- Console.WriteLine($"{ (rating / models):f2}");
- }
- }
- }
Add Comment
Please, Sign In to add comment