-
Notifications
You must be signed in to change notification settings - Fork 1
/
Task1.cs
52 lines (46 loc) · 1.81 KB
/
Task1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Task_1
{
class Program
{
static void Main(string[] args)
{
double checkSumm = 337.77;
/*
double discount = 0;
if (checkSumm <= 300)
{
Console.WriteLine($"Сумма до сплати - {checkSumm - discount}\nВаша знижка - {discount}");
}
else if (checkSumm > 300 && checkSumm <= 400)
{
discount = checkSumm * 0.02;
Console.WriteLine($"Сумма до сплати - {checkSumm - discount}\nВаша знижка - {discount}");
}
else if (checkSumm > 400 && checkSumm < 500)
{
discount = checkSumm * 0.03;
Console.WriteLine($"Сумма до сплати - {checkSumm - discount}\nВаша знижка - {discount}");
}
else if (checkSumm >= 500)
{
discount = checkSumm * 0.05;
Console.WriteLine($"Сумма до сплати - {checkSumm - discount}\nВаша знижка - {discount}");
}
Console.ReadKey();
*/
double discount =
checkSumm <= 300 ? 0 :
checkSumm > 300 && checkSumm <= 400 ? checkSumm * 0.02 :
checkSumm > 400 && checkSumm < 500 ? checkSumm * 0.03 :
checkSumm * 0.05;
discount = Math.Round(discount, 2);
Console.WriteLine($"Сумма до сплати - {checkSumm - discount}\nВаша знижка - {discount}");
Console.ReadKey();
}
}
}