From d7c3bee155962e10079d296223270a9f32d6b8f1 Mon Sep 17 00:00:00 2001 From: Stanislav Mykhailenko Date: Mon, 6 Mar 2023 13:52:12 +0200 Subject: [PATCH] Add Lesson 1 Task 4 --- Lesson_1/Task_4/Program.cs | 19 +++++++++++++++++++ Lesson_1/Task_4/Task_4.csproj | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Lesson_1/Task_4/Program.cs create mode 100644 Lesson_1/Task_4/Task_4.csproj diff --git a/Lesson_1/Task_4/Program.cs b/Lesson_1/Task_4/Program.cs new file mode 100644 index 0000000..d1e3086 --- /dev/null +++ b/Lesson_1/Task_4/Program.cs @@ -0,0 +1,19 @@ +Console.Write("Enter string 1: "); + +string? string1 = Console.ReadLine(); + +Console.Write("Enter string 2: "); + +string? string2 = Console.ReadLine(); + +if (string1 == null || string2 == null) +{ +} +else if (string1.Length > string2.Length) + Console.WriteLine(string1 + string2); +else if (string1.Length < string2.Length) +{ + string[] split = string2.Split(string1[0]); + foreach (string value in split) + Console.WriteLine(value); +} diff --git a/Lesson_1/Task_4/Task_4.csproj b/Lesson_1/Task_4/Task_4.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/Lesson_1/Task_4/Task_4.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + +