-
Notifications
You must be signed in to change notification settings - Fork 1
/
Task2_1.cs
46 lines (40 loc) · 1.16 KB
/
Task2_1.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Task2_1
{
class Program
{
static void Main(string[] args)
{
Random r = new Random();
int randomNuber = r.Next(0, 100);
for (int i = 1; i < 6; i++)
{
Console.WriteLine($"try №{i} Enter the number between 0 and 100");
int enter = int.Parse(Console.ReadLine());
if (enter > randomNuber)
{
Console.WriteLine("NO! Enter Smaller number");
}
else if (enter < randomNuber)
{
Console.WriteLine("NO! Enter Biger number");
}
else if (enter == randomNuber)
{
Console.WriteLine("YOU WIN!!!");
break;
}
if (i == 5)
{
Console.WriteLine("SORRY! YOU LOSE!");
}
}
Console.WriteLine(randomNuber);
Console.ReadKey();
}
}
}