Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _11.HappyCatParking
- {
- class HappyCatParking
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- int hours = int.Parse(Console.ReadLine());
- double totalPrice = 0;
- for (int day = 1; day <= days; day++)
- {
- double priceDay = 0;
- for (int hour = 1; hour <= hours; hour++)
- {
- if (day % 2 == 0 && hour % 2 != 0)
- {
- priceDay = priceDay + 2.50;
- }
- else if (day % 2 == 0 && hour % 2 == 0)
- {
- priceDay = priceDay + 1;
- }
- else if (day % 2 != 0 && hour % 2 == 0)
- {
- priceDay = priceDay + 1.25;
- }
- else if (day % 2 != 0 && hour % 2 != 0)
- {
- priceDay = priceDay + 1;
- }
- }
- totalPrice += priceDay;
- Console.WriteLine($"Day: {day} - {priceDay:f2} leva");
- }
- Console.WriteLine($"Total: {totalPrice:f2} leva");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment