Advertisement
NadyaMisheva

zadacha 3 test

Dec 9th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int days = int.Parse(Console.ReadLine());
  8.         string room = Console.ReadLine();
  9.         int PriceA = days * 70;
  10.         int PriceP = days * 125;
  11.         if (room == "apartment")
  12.         {
  13.             if (days < 10)
  14.             {
  15.                 Console.WriteLine("{0:F2}", PriceA - PriceA * 0.3);
  16.             }
  17.             else if (days <= 15)
  18.             {
  19.                 Console.WriteLine("{0:F2}", PriceA - PriceA * 0.35);
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine("{0:F2}", PriceA - PriceA * 0.5);
  24.             }
  25.         }
  26.         else if (room == "president apartment")
  27.         {
  28.             if ( days < 10)
  29.             {
  30.                 Console.WriteLine("{0:F2}", PriceP - PriceP * 0.1);
  31.             }
  32.             else if (days <= 15)
  33.             {
  34.                 Console.WriteLine("{0:F2}", PriceP - PriceP * 0.15);
  35.             }
  36.             else
  37.             {
  38.                 Console.WriteLine("{0:F2}", PriceP - PriceP * 0.2);
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement