BorislavBorisov

17.01.Garden мое решение

Nov 8th, 2015
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.49 KB | None | 0 0
  1. using System;
  2. class Garden
  3. {
  4.     static void Main()
  5.     {
  6.         int area = 0;
  7.         decimal seeds = 0m;
  8.         CheckSeedsAmmount(seeds, area);
  9.     }
  10.  
  11.     static void CheckSeedsAmmount(decimal seeds, int area)
  12.     {
  13.         for (int i = 0; i <= 10; i++)
  14.         {
  15.             if (i == 0 || i == 1)
  16.             {
  17.                 if (i == 0)
  18.                 {
  19.                     seeds += decimal.Parse(Console.ReadLine()) * 0.5m;
  20.                 }
  21.                 else
  22.                 {
  23.                     area += byte.Parse(Console.ReadLine());
  24.                 }
  25.             }
  26.             if (i == 2 || i == 3)
  27.             {
  28.                 if (i == 2)
  29.                 {
  30.                     seeds += decimal.Parse(Console.ReadLine()) * 0.4m;
  31.                 }
  32.                 else
  33.                 {
  34.                     area += byte.Parse(Console.ReadLine());
  35.                 }
  36.             }
  37.             if (i == 4 || i == 5)
  38.             {
  39.                 if (i == 4)
  40.                 {
  41.                     seeds += decimal.Parse(Console.ReadLine()) * 0.25m;
  42.                 }
  43.                 else
  44.                 {
  45.                     area += byte.Parse(Console.ReadLine());
  46.                 }
  47.             }
  48.             if (i == 6 || i == 7)
  49.             {
  50.                 if (i == 6)
  51.                 {
  52.                     seeds += decimal.Parse(Console.ReadLine()) * 0.6m;
  53.                 }
  54.                 else
  55.                 {
  56.                     area += byte.Parse(Console.ReadLine());
  57.                 }
  58.             }
  59.             if (i == 8 || i == 9)
  60.             {
  61.                 if (i == 8)
  62.                 {
  63.                     seeds += decimal.Parse(Console.ReadLine()) * 0.3m;
  64.                 }
  65.                 else
  66.                 {
  67.                     area += byte.Parse(Console.ReadLine());
  68.                 }
  69.             }
  70.             if (i == 10)
  71.             {
  72.                 seeds += decimal.Parse(Console.ReadLine()) * 0.4m;
  73.             }
  74.         }
  75.         if(area < 250)
  76.         {
  77.             Console.WriteLine("Total costs: " + seeds);
  78.             Console.WriteLine("Beans area: " + (250 - area));
  79.         }
  80.         else if(area == 250)//(area - 250 == 0)
  81.         {
  82.             Console.WriteLine("Total costs: " + seeds);
  83.             Console.WriteLine("No area for beans ");
  84.         }
  85.         else
  86.         {
  87.             Console.WriteLine("Total costs: " + seeds);
  88.             Console.WriteLine("Insufficient area ");
  89.         }
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment