Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO.IsolatedStorage;
- using System.Linq;
- namespace _02._Odd_Occurrences
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- int hours = int.Parse(Console.ReadLine());
- //1. преминем (обходим всички)
- double totalSum = 0; //обща сума
- for (int day = 1; day <= days; day++)
- {
- //какво искаме да се случи за всеки един ден
- double sum = 0; //сума за деня
- for (int hour = 1; hour <= hours; hour++)
- {
- //четен ден и нечетен час
- if (day % 2 == 0 && hour % 2 == 1)
- {
- sum += 2.50;
- totalSum += 2.50;
- }
- //нечетен ден и четен час
- else if (day % 2 == 1 && hour % 2 == 0)
- {
- sum += 1.25;
- totalSum += 1.25;
- }
- else
- {
- sum += 1;
- totalSum += 1;
- }
- }
- Console.WriteLine($"Day: {day} - {sum:F2} leva");
- }
- Console.WriteLine($"Total: {totalSum:F2} leva");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement