Advertisement
silvana1303

happycat parking

Apr 25th, 2020
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Loops
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int days = int.Parse(Console.ReadLine());
  10.             int hours = int.Parse(Console.ReadLine());
  11.  
  12.             double tax = 0.0;
  13.             double taxPerDay = 0.0;
  14.  
  15.             for (int i = 1; i <= days; i++)
  16.             {
  17.                 for (int j = 1; j <= hours; j++)
  18.                 {
  19.                     if (i % 2 == 0 && j % 2 != 0)
  20.                     {
  21.                         tax += 2.50;
  22.                         taxPerDay += 2.50;
  23.                     }
  24.                     else if (i % 2 != 0 && j % 2 == 0)
  25.                     {
  26.                         tax += 1.25;
  27.                         taxPerDay += 1.25;
  28.                     }
  29.                     else
  30.                     {
  31.                         tax += 1;
  32.                         taxPerDay += 1;
  33.                     }
  34.  
  35.                    
  36.                 }
  37.  
  38.                 Console.WriteLine($"Day: {i} - {tax:f2} leva");
  39.                 tax = 0;
  40.             }
  41.  
  42.             Console.WriteLine($"Total : {taxPerDay:f2} leva");
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement