Advertisement
radostina92

Untitled

May 9th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. using System;
  2.  
  3. namespace VeterinarenParking
  4. {
  5.     class VeterinarenParking
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int days = int.Parse(Console.ReadLine());
  10.             int hours = int.Parse(Console.ReadLine());
  11.             double price = 0;
  12.             double cntPrice = 0;
  13.             double cntPrice1 = 0;
  14.             double cntPrice2 = 0;
  15.            
  16.             for (int i = 1; i <= days; i++)
  17.             {
  18.                 for (int n = 1; n <= hours; n++)
  19.                 {
  20.                     if (i % 2 == 0 && n % 2 != 0)
  21.                     {
  22.                         price = 2.50;
  23.                         cntPrice = cntPrice + price;
  24.                     }
  25.                     if (i % 2 != 0 && n % 2 == 0)
  26.                     {
  27.                         price = 1.25;
  28.                         cntPrice1 = cntPrice1 + price;
  29.                     }
  30.                     else
  31.                     {
  32.                         price = 1;
  33.                         cntPrice2 = cntPrice2 + price;
  34.                     }
  35.  
  36.  
  37.                     if (i == 1)
  38.                     {
  39.                         double newPrice = price * hours;
  40.                         Console.WriteLine($"Day:  {i} – {newPrice:f2} leva");
  41.                     }
  42.                     if (i == 2)
  43.                     {
  44.                         double newPrice = price * hours;
  45.                         Console.WriteLine($"Day:  {i} – {newPrice:f2} leva");
  46.                     }
  47.                     if (i == 3)
  48.                     {
  49.                         double newPrice = price * hours;
  50.                         Console.WriteLine($"Day:  {i} – {newPrice:f2} leva");
  51.                     }
  52.                     if (i == 4)
  53.                     {
  54.  
  55.                         double newPrice = price * hours;
  56.                         Console.WriteLine($"Day:  {i} – {newPrice:f2} leva");
  57.  
  58.                     }
  59.                     if (i == 5)
  60.                     {
  61.                         double newPrice = price * hours;
  62.                         Console.WriteLine($"Day:  {i} – {newPrice:f2} leva");
  63.                     }
  64.                 }
  65.             }
  66.             double sum = cntPrice + cntPrice1 + cntPrice2;
  67.             Console.WriteLine($"Total: {sum:f2}");
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement