New House . В Judg -a ми дава 20/100. Със 64 гладиоли и 128 лв. при мен излиза вярно.
using System;
namespace Upr_22._07._21
{
class Program
{
static void Main(string[] args)
{
string flower = Console.ReadLine();
int numFlower = int.Parse(Console.ReadLine());
int budget = int.Parse(Console.ReadLine());
double c = 0;
switch (flower)
{
case "Roses":
if (numFlower * 5 <= budget && numFlower > 80)
{
c = budget - numFlower * 5 * 0.9;
Console.WriteLine($"Hey, you have a great garden with {numFlower} {flower} and {c:f2} leva left.");
}
if (numFlower * 5 > budget)
{
c = numFlower * 5 - budget;
Console.WriteLine($"Not enough money, you need {c:f2} leva more.");
}
break;
case "Dahlias":
if (numFlower * 3.8 <= budget && numFlower > 90)
{
c = budget - numFlower * 3.8 * 0.85;
Console.WriteLine($"Hey, you have a great garden with {numFlower} {flower} and {c:f2} leva left.");
}
if (numFlower * 3.8 > budget)
{
c = numFlower * 3.8 - budget;
Console.WriteLine($"Not enough money, you need {c:f2} leva more.");
}
break;
case "Tulips":
if (numFlower * 2.8 <= budget && numFlower > 80)
{
c = budget - numFlower * 2.8 * 0.85;
Console.WriteLine($"Hey, you have a great garden with {numFlower} {flower} and {c:f2} leva left.");
}
if (numFlower * 2.8 > budget)
{
c = numFlower * 2.8 - budget;
Console.WriteLine($"Not enough money, you need {c:f2} leva more.");
}
break;
case "Narcissus":
if (numFlower * 3 <= budget && numFlower < 120)
{
c = budget - numFlower * 3 * 1.15;
Console.WriteLine($"Hey, you have a great garden with {numFlower} {flower} and {c:f2} leva left.");
}
if (numFlower * 3 > budget )
{
c = numFlower * 3 - budget;
Console.WriteLine($"Not enough money, you need {c:f2} leva more.");
}
break;
case "Gladiolus":
if (numFlower * 2.5 <= budget && numFlower < 80)
{
c = budget - numFlower * 2.5 * 1.2;
Console.WriteLine($"Hey, you have a great garden with {numFlower} {flower} and {c:f2} leva left.");
}
if (numFlower * 2.5 > budget )
{
c = numFlower * 2.5 - budget;
Console.WriteLine($"Not enough money, you need {c:f2} leva more.");
}
break;
}
}
}
}
Благодаря
Моля.
Thanks for response, I found a lot of interesting information here. very thankful and helpful.
MyBalanceNow