diff --git a/Session02/ConsoleApp1/ConsoleApp1.sln b/Session02/ConsoleApp1/ConsoleApp1.sln new file mode 100644 index 0000000..c9a397b --- /dev/null +++ b/Session02/ConsoleApp1/ConsoleApp1.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{0CDB9C9E-2F2C-4E95-9761-DA19DB872C5D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0CDB9C9E-2F2C-4E95-9761-DA19DB872C5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CDB9C9E-2F2C-4E95-9761-DA19DB872C5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CDB9C9E-2F2C-4E95-9761-DA19DB872C5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CDB9C9E-2F2C-4E95-9761-DA19DB872C5D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4025A1B4-422B-40C7-9624-54D828A1EA67} + EndGlobalSection +EndGlobal diff --git a/Session02/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj b/Session02/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/ConsoleApp1/ConsoleApp1/Program.cs b/Session02/ConsoleApp1/ConsoleApp1/Program.cs new file mode 100644 index 0000000..b23b735 --- /dev/null +++ b/Session02/ConsoleApp1/ConsoleApp1/Program.cs @@ -0,0 +1,40 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + var integerValues = new[] { 1, 2, 3 }; + var name = nameof(integerValues); + Console.WriteLine("For-loop"); + for (var i = 0; i < integerValues.Length; i++) + { + var value = integerValues[i]; + + Console.WriteLine($"Index {i} i arrayen {name} har värdet: {value}"); + } + Console.WriteLine(); + Console.WriteLine("Do-while-loop"); + var doWhileIndex = 0; + do + { + var value = integerValues[doWhileIndex]; + Console.WriteLine($"Index {doWhileIndex} i arrayen {name} har värdet: {value}"); + doWhileIndex++; + } + while (doWhileIndex < integerValues.Length); + + var whileIndex = 0; + Console.WriteLine(); + Console.WriteLine("While-loop"); + while(whileIndex < integerValues.Length) + { + var value = integerValues[whileIndex]; + Console.WriteLine($"Index {whileIndex} i arrayen {name} har värdet: {value}"); + whileIndex++; + } + } + } +} diff --git a/Session02/Session02/ConsoleApp1/ConsoleApp1.csproj b/Session02/Session02/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02/ConsoleApp1/Program.cs b/Session02/Session02/ConsoleApp1/Program.cs new file mode 100644 index 0000000..8997572 --- /dev/null +++ b/Session02/Session02/ConsoleApp1/Program.cs @@ -0,0 +1,71 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + var additionResult = 1 + 2; + Console.WriteLine("Additionresult: " + additionResult); + var incrementResult1 = additionResult++; + var incrementResult2 = ++additionResult; + Console.WriteLine("incrementresult: " + incrementResult1); + Console.WriteLine("incrementresult: " + incrementResult2); + + var trueValue = true; + var falseValue = false; + + // Inte boolsk jämförelse + var andResult = 0b0010 & 0b0100; // 0b0110 + var orResult = trueValue | falseValue; + var xorResult = trueValue ^ falseValue; + + Console.WriteLine("andResult: " + andResult); + Console.WriteLine("orResult: " + orResult); + Console.WriteLine("xorValue: " + xorResult); + + var moduleResult = 3 % 2; + + Console.WriteLine("ModuleResult: " + moduleResult); + + var highInteger = 1000; + var divisionResult = highInteger / 3; + // Implicit värdekonvertering till double + var doubleDivisionResult = highInteger / 3.0; + + var forcedIntDivisionResult = (int)(highInteger / 3.0); + + Console.WriteLine("DivisionResult: " + divisionResult); + Console.WriteLine("DoubleDivisionResult: " + doubleDivisionResult); + Console.WriteLine("forcedIntDivisionResult: " + forcedIntDivisionResult); + + var conversionResult = Convert.ToInt32(doubleDivisionResult); + Console.WriteLine("conversionResult: " + conversionResult); + + var midpointDivisionResult = 1.0 / 3.0; + + Console.WriteLine("midpointDivisionResult: " + midpointDivisionResult); + Console.WriteLine("castToInt: " + ((int)midpointDivisionResult)); + Console.WriteLine("Ceiling: " + Math.Ceiling(midpointDivisionResult)); + Console.WriteLine("Floor: " + Math.Floor(midpointDivisionResult)); + Console.WriteLine("Round: " + Math.Round(midpointDivisionResult, 3)); + + //Det går även att använda sammanslagna operatorer + // -= + // += + // *= + // /= + + // Finns även <=, >=, ==, + var greaterResult = 5 > 3; + var lessThanResult = 5 < 3; + + Console.WriteLine("greaterThanREsult: " + greaterResult); + Console.WriteLine("lessThanResult: " + lessThanResult); + + + + } + } +} diff --git a/Session02/Session02/Session02.sln b/Session02/Session02/Session02.sln new file mode 100644 index 0000000..c9e2134 --- /dev/null +++ b/Session02/Session02/Session02.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session02Excercise01", "Session02Excercise01\Session02Excercise01.csproj", "{19876383-95F1-4AF9-AED1-87B1940C5CA4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise02", "Session02Exercise02\Session02Exercise02.csproj", "{B6BA7FFB-6B0D-4079-B268-2E00DA25480D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{FABF555D-DB61-4EE6-AD9F-A6FC603412FB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Example04", "Session02Example04\Session02Example04.csproj", "{18E7D114-46CA-494E-819B-031C8EC8420D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19876383-95F1-4AF9-AED1-87B1940C5CA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19876383-95F1-4AF9-AED1-87B1940C5CA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19876383-95F1-4AF9-AED1-87B1940C5CA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19876383-95F1-4AF9-AED1-87B1940C5CA4}.Release|Any CPU.Build.0 = Release|Any CPU + {B6BA7FFB-6B0D-4079-B268-2E00DA25480D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6BA7FFB-6B0D-4079-B268-2E00DA25480D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6BA7FFB-6B0D-4079-B268-2E00DA25480D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6BA7FFB-6B0D-4079-B268-2E00DA25480D}.Release|Any CPU.Build.0 = Release|Any CPU + {FABF555D-DB61-4EE6-AD9F-A6FC603412FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FABF555D-DB61-4EE6-AD9F-A6FC603412FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FABF555D-DB61-4EE6-AD9F-A6FC603412FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FABF555D-DB61-4EE6-AD9F-A6FC603412FB}.Release|Any CPU.Build.0 = Release|Any CPU + {18E7D114-46CA-494E-819B-031C8EC8420D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18E7D114-46CA-494E-819B-031C8EC8420D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18E7D114-46CA-494E-819B-031C8EC8420D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18E7D114-46CA-494E-819B-031C8EC8420D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {29AF081A-69D3-4EEB-A68C-563945E90467} + EndGlobalSection +EndGlobal diff --git a/Session02/Session02/Session02Example04/Program.cs b/Session02/Session02/Session02Example04/Program.cs new file mode 100644 index 0000000..cc571c2 --- /dev/null +++ b/Session02/Session02/Session02Example04/Program.cs @@ -0,0 +1,51 @@ +using System; + +namespace Session02Example04 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ålder: "); + var input = Console.ReadLine(); + var integer = Convert.ToInt32(input); + + if (integer >= 18) + { + Console.WriteLine("Du får köpa tobaksprodukter"); + } + else + { + Console.WriteLine("Du får inte köpa tobaksprodukter"); + } + + if (integer >= 40) + { + Console.WriteLine("Du är jättegammal"); + } + + Console.WriteLine("Ange vattentemperatur i grader C: "); + var input1 = Console.ReadLine(); + var integer1 = Convert.ToInt32(input1); + + string waterLabel = integer1 >= 27 ? "Går att bada" : "Går inte att bada"; + //if (integer1 >= 27) + //{ + //Console.WriteLine("Går att bada"); + //} + //else + //{ + // Console.WriteLine("Det går inte att bada"); + //} + + switch (integer1) + { + case 1: waterLabel = "Går inte att bada alls"; break; + case -3: waterLabel = "Det är 3 minusgrader"; break; + } + Console.WriteLine(waterLabel + " i havet"); + + + } + } +} diff --git a/Session02/Session02/Session02Example04/Session02Example04.csproj b/Session02/Session02/Session02Example04/Session02Example04.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02/Session02Example04/Session02Example04.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02/Session02Excercise01/Program.cs b/Session02/Session02/Session02Excercise01/Program.cs new file mode 100644 index 0000000..7159b08 --- /dev/null +++ b/Session02/Session02/Session02Excercise01/Program.cs @@ -0,0 +1,18 @@ +using System; + +namespace Session02Excercise01 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + + var integer = 0; + string stringValue = "MyStringValue"; + + Console.WriteLine("Integer is " + integer.ToString()); + Console.WriteLine("The value of stringValue is: " + stringValue); + } + } +} diff --git a/Session02/Session02/Session02Excercise01/Session02Excercise01.csproj b/Session02/Session02/Session02Excercise01/Session02Excercise01.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02/Session02Excercise01/Session02Excercise01.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02/Session02Exercise02/Program.cs b/Session02/Session02/Session02Exercise02/Program.cs new file mode 100644 index 0000000..c83d1da --- /dev/null +++ b/Session02/Session02/Session02Exercise02/Program.cs @@ -0,0 +1,22 @@ +using System; +namespace Session02Exercise02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Do you want to enter your name? (y/n)!"); + var key = Console.ReadKey(); + + if (key.KeyChar == 'n') + { + return; + } + Console.WriteLine("Enter your name:"); + var name = Console.ReadLine(); + + Console.WriteLine("Hello, " + name); + Console.ReadKey(); + } + } +} diff --git a/Session02/Session02/Session02Exercise02/Session02Exercise02.csproj b/Session02/Session02/Session02Exercise02/Session02Exercise02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02/Session02Exercise02/Session02Exercise02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02ex02/Session02Exercise02/Program.cs b/Session02/Session02ex02/Session02Exercise02/Program.cs new file mode 100644 index 0000000..663b361 --- /dev/null +++ b/Session02/Session02ex02/Session02Exercise02/Program.cs @@ -0,0 +1,23 @@ +using System; + +namespace Session02Exercise02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Do you want to enter your name? (y/n)!"); + var key = Console.ReadKey(); + + if (key.KeyChar == 'n') + { + return; + } + Console.WriteLine("Enter your name:"); + var name = Console.ReadLine(); + + Console.WriteLine("Hello, " + name); + Console.ReadKey(); + } + } +} diff --git a/Session02/Session02ex02/Session02Exercise02/Session02Exercise02.csproj b/Session02/Session02ex02/Session02Exercise02/Session02Exercise02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02ex02/Session02Exercise02/Session02Exercise02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02ex02/Session02ex02.sln b/Session02/Session02ex02/Session02ex02.sln new file mode 100644 index 0000000..d6d2bb3 --- /dev/null +++ b/Session02/Session02ex02/Session02ex02.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise02", "Session02Exercise02\Session02Exercise02.csproj", "{B1019ED2-4FE5-428A-BBDE-C759C7A53C90}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1019ED2-4FE5-428A-BBDE-C759C7A53C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1019ED2-4FE5-428A-BBDE-C759C7A53C90}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1019ED2-4FE5-428A-BBDE-C759C7A53C90}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1019ED2-4FE5-428A-BBDE-C759C7A53C90}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {49EFCB3E-6855-4062-BC6E-F9B69B92A772} + EndGlobalSection +EndGlobal diff --git a/Session02/Session03/Session03.sln b/Session02/Session03/Session03.sln new file mode 100644 index 0000000..ac4a069 --- /dev/null +++ b/Session02/Session03/Session03.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Exercise02", "Session03Exercise02\Session03Exercise02.csproj", "{8BDD4CF9-8135-44E8-8604-0650A7FD6D28}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BDD4CF9-8135-44E8-8604-0650A7FD6D28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BDD4CF9-8135-44E8-8604-0650A7FD6D28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BDD4CF9-8135-44E8-8604-0650A7FD6D28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BDD4CF9-8135-44E8-8604-0650A7FD6D28}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CBE1BF82-DE25-495C-B0C8-733790FC6FDE} + EndGlobalSection +EndGlobal diff --git a/Session02/Session03/Session03Exercise02/Program.cs b/Session02/Session03/Session03Exercise02/Program.cs new file mode 100644 index 0000000..3f908e7 --- /dev/null +++ b/Session02/Session03/Session03Exercise02/Program.cs @@ -0,0 +1,131 @@ +using System; +using System.Globalization; + +namespace Session03Exercise02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ett antal siffror, separerat med kommatecken."); + var input = Console.ReadLine(); + Console.WriteLine(); + // Alternativt var inputArray = input.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + + #region min grej + /* + int total = 0; + int loops = 0; + int maxValue = 0; + int minValue = Convert.ToInt32(inputArray[0]); + int testValue; + + foreach (var number in inputArray) + { + Console.WriteLine("Värdet är " + number); + + testValue = Convert.ToInt32(number); + if (maxValue < testValue) + { + maxValue = testValue; + } + + if (minValue > testValue) + { + minValue = testValue; + } + + total += Convert.ToInt32(number); + loops++; + } + Console.WriteLine(); + Console.WriteLine("Medelvärdet är: " + total/loops); + Console.WriteLine(); + Console.WriteLine("Max värdet är: " + maxValue); + Console.WriteLine(); + Console.WriteLine("Min värdet är: " + minValue); + */ + #endregion + double? [] array = new double?[inputArray.Length]; + #region min andra grej + /* + for (int i = 0; i testValue) + { + minValue = testValue; + } + + total += number; + loops++; + } + Console.WriteLine(); + Console.WriteLine("Medelvärdet är: " + total / loops); + Console.WriteLine(); + Console.WriteLine("Det högsta värdet är: " + maxValue); + Console.WriteLine(); + Console.WriteLine("Det minsta värdet är: " + minValue); + } + } +} diff --git a/Session02/Session03/Session03Exercise02/Session03Exercise02.csproj b/Session02/Session03/Session03Exercise02/Session03Exercise02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session03/Session03Exercise02/Session03Exercise02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git "a/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3.sln" "b/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3.sln" new file mode 100644 index 0000000..680df0c --- /dev/null +++ "b/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3.sln" @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Övningar lektion 3", "Övningar lektion 3\Övningar lektion 3.csproj", "{20FC56F0-46EC-47DD-9079-C7452C7C0C27}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {20FC56F0-46EC-47DD-9079-C7452C7C0C27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20FC56F0-46EC-47DD-9079-C7452C7C0C27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20FC56F0-46EC-47DD-9079-C7452C7C0C27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20FC56F0-46EC-47DD-9079-C7452C7C0C27}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {96358039-F896-4E90-AFFC-E49A05F34BA1} + EndGlobalSection +EndGlobal diff --git "a/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3/Program.cs" "b/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3/Program.cs" new file mode 100644 index 0000000..47043bb --- /dev/null +++ "b/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3/Program.cs" @@ -0,0 +1,54 @@ +using System; + +namespace Övningar_lektion_3 +{ + class Program + { + static void Main(string[] args) + { + // Övning 1 + /*Console.WriteLine("Input value 1:"); + int input1 = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Input value 2:"); + int input2 = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine(); + for (int i = input1 + 1; i < input2; i++) + { + Console.WriteLine(i); + } + */ + // Övning 2 + for (int i = 1; i < 65; i++) + { + int test = i % 2; + int lineBreak = i % 8; + int lineSwitch = 1; + + if (lineSwitch % 2 == 1) + { + if (lineBreak == 1) + { + Console.Write("\n"); + lineSwitch++; + } + if (test == 1) + Console.Write('▓'); + else + Console.Write('░'); + } + else if (lineSwitch % 2 == 0) + { + if (lineBreak == 1) + { + Console.Write("\n"); + lineSwitch++; + } + if (test == 0) + Console.Write('▓'); + else + Console.Write('░'); + } + } + } + } +} diff --git "a/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3/\303\226vningar lektion 3.csproj" "b/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3/\303\226vningar lektion 3.csproj" new file mode 100644 index 0000000..982ec1d --- /dev/null +++ "b/Session02/\303\226vningar lektion 3/\303\226vningar lektion 3/\303\226vningar lektion 3.csproj" @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp3.1 + Övningar_lektion_3 + + +