Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _10.RageExpenses
- {
- class RageExpenses
- {
- static void Main(string[] args)
- {
- int lostGames = int.Parse(Console.ReadLine());
- decimal headsetPrice = decimal.Parse(Console.ReadLine());
- decimal mousePrice = decimal.Parse(Console.ReadLine());
- decimal keyboardPrice = decimal.Parse(Console.ReadLine());
- decimal displayPrice = decimal.Parse(Console.ReadLine());
- decimal sumHeadset = 0;
- decimal sumMouse = 0;
- decimal sumKeyboard = 0;
- decimal sumDisplay = 0;
- decimal temp = 0;
- for (int i = 1; i <= lostGames; i++)
- {
- if (i % 2 == 0 && i % 3 == 0)
- {
- temp++;
- if (temp % 2 == 0)
- {
- sumDisplay += displayPrice;
- }
- sumKeyboard += keyboardPrice;
- }
- if (i % 3 == 0)
- {
- sumMouse += mousePrice;
- }
- if (i % 2 == 0)
- {
- sumHeadset += headsetPrice;
- }
- }
- decimal sumAll = sumHeadset + sumMouse + sumKeyboard + sumDisplay;
- Console.WriteLine($"Rage expenses: {sumAll:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement