From cbd7dd7ebffc9f7e58c97429af4f5190214bd166 Mon Sep 17 00:00:00 2001
From: aXayitov <137428961+aXayitov@users.noreply.github.com>
Date: Sat, 16 Sep 2023 19:32:28 +0500
Subject: [PATCH 1/3] 12122
---
Lesson01/Lesson01/Program.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Lesson01/Lesson01/Program.cs b/Lesson01/Lesson01/Program.cs
index 2774e62..ad8b655 100644
--- a/Lesson01/Lesson01/Program.cs
+++ b/Lesson01/Lesson01/Program.cs
@@ -11,7 +11,12 @@ static void Main(string[] args)
// Complete the following method
public static int Add(int a, int b)
{
- return 0;
+ if (a < b)
+ {
+ Console.WriteLine($"{a} smaller than {b}");
+ return 0;
+ }
+ return a - b;
}
}
}
\ No newline at end of file
From 24367eda49c443e0a67978ec9f7a3c0624980261 Mon Sep 17 00:00:00 2001
From: aXayitov <137428961+aXayitov@users.noreply.github.com>
Date: Sat, 16 Sep 2023 20:34:40 +0500
Subject: [PATCH 2/3] xato tuzatildi
---
Lesson01/Lesson01/Program.cs | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/Lesson01/Lesson01/Program.cs b/Lesson01/Lesson01/Program.cs
index ad8b655..77dacd2 100644
--- a/Lesson01/Lesson01/Program.cs
+++ b/Lesson01/Lesson01/Program.cs
@@ -7,16 +7,9 @@ static void Main(string[] args)
Console.WriteLine("Hello, World!");
}
- // Homework
- // Complete the following method
public static int Add(int a, int b)
{
- if (a < b)
- {
- Console.WriteLine($"{a} smaller than {b}");
- return 0;
- }
- return a - b;
+ return a + b;
}
}
}
\ No newline at end of file
From 904c38f8f712652a314bbfc1733142e4aed626c4 Mon Sep 17 00:00:00 2001
From: aXayitov <137428961+aXayitov@users.noreply.github.com>
Date: Sat, 23 Sep 2023 19:08:32 +0500
Subject: [PATCH 3/3] Homeeork (Abdurakhmon)
---
Lesson04/Lesson04.sln | 25 ++++++++
Lesson04/Lesson04/Lesson04.csproj | 10 ++++
Lesson04/Lesson04/Program.cs | 97 +++++++++++++++++++++++++++++++
3 files changed, 132 insertions(+)
create mode 100644 Lesson04/Lesson04.sln
create mode 100644 Lesson04/Lesson04/Lesson04.csproj
create mode 100644 Lesson04/Lesson04/Program.cs
diff --git a/Lesson04/Lesson04.sln b/Lesson04/Lesson04.sln
new file mode 100644
index 0000000..b4af16e
--- /dev/null
+++ b/Lesson04/Lesson04.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33815.320
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson04", "Lesson04\Lesson04.csproj", "{2BD7DB44-DD50-4842-8301-2355386ED7AF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2BD7DB44-DD50-4842-8301-2355386ED7AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2BD7DB44-DD50-4842-8301-2355386ED7AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2BD7DB44-DD50-4842-8301-2355386ED7AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2BD7DB44-DD50-4842-8301-2355386ED7AF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {69432ABB-02AF-4CEB-ADBD-A1736AFB0F56}
+ EndGlobalSection
+EndGlobal
diff --git a/Lesson04/Lesson04/Lesson04.csproj b/Lesson04/Lesson04/Lesson04.csproj
new file mode 100644
index 0000000..f02677b
--- /dev/null
+++ b/Lesson04/Lesson04/Lesson04.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net7.0
+ enable
+ enable
+
+
+
diff --git a/Lesson04/Lesson04/Program.cs b/Lesson04/Lesson04/Program.cs
new file mode 100644
index 0000000..afbfe1c
--- /dev/null
+++ b/Lesson04/Lesson04/Program.cs
@@ -0,0 +1,97 @@
+namespace Lesson04
+{
+ internal class Program
+ {
+ public delegate bool Predicate1(int t, int max);
+
+ static void Main(string[] args)
+ {
+ int[] numbers = { 1, 9, 3, 4, -5, -6, -7, 8 };
+ Where(numbers, NegativeNumbers);
+ }
+ static void Count(int[] number, Predicate predicate)
+ {
+ int counter = 0;
+ foreach (int i in number)
+ {
+ if (predicate(i))
+ {
+ counter++;
+ }
+ }
+ Console.WriteLine(counter);
+ }
+ static void Max(int[] number, Predicate1 predicate)
+ {
+ int max = 0;
+ for (int i = 0; i < number.Length; ++i)
+ {
+ if (predicate(max, number[i]))
+ {
+ max = number[i];
+ }
+ }
+ Console.WriteLine(max);
+ }
+ static void Min(int[] number, Predicate1 predicate)
+ {
+ int min = number[0];
+ for (int i = 1; i < number.Length - 1; ++i)
+ {
+ if (predicate(min, number[i]))
+ {
+ min = number[i];
+ }
+ }
+ Console.WriteLine(min);
+ }
+ static void Where(int[] number, Predicate predicate)
+ {
+ List numbers = new List();
+ for (int i = 0; i < number.Length; ++i)
+ {
+ if (predicate(number[i]))
+ {
+ numbers.Add(number[i]);
+ }
+ }
+ foreach (int i in numbers)
+ {
+ Console.WriteLine(i);
+ }
+ }
+ static bool NegativeNumbers(int num)
+ {
+ if (num < 0)
+ {
+ return true;
+ }
+ return false;
+ }
+ static bool MinMax(int num1, int max)
+ {
+ if (num1 < max)
+ {
+ return true;
+ }
+ return false;
+ }
+ static bool Positive(int number)
+ {
+ if (number < 0)
+ {
+ return false;
+ }
+ return true;
+ }
+ static bool MinNumber(int number, int min)
+ {
+ if (min < number)
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+}
+