From 3c7fa0d4faa8ca2fbdb529edd897537632a35666 Mon Sep 17 00:00:00 2001 From: Sam Mangum-Bostick Date: Sun, 27 Jan 2019 15:09:40 -0600 Subject: [PATCH 1/3] added array --- FizzBuzz/FizzBuzz.cs | 20 +++++++++++++++++++- sort/.vscode/launch.json | 28 ++++++++++++++++++++++++++++ sort/.vscode/tasks.json | 15 +++++++++++++++ sort/Program.cs | 15 +++++++++++++++ sort/sort.csproj | 8 ++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 sort/.vscode/launch.json create mode 100644 sort/.vscode/tasks.json create mode 100644 sort/Program.cs create mode 100644 sort/sort.csproj diff --git a/FizzBuzz/FizzBuzz.cs b/FizzBuzz/FizzBuzz.cs index 9246f703..cbe9d343 100644 --- a/FizzBuzz/FizzBuzz.cs +++ b/FizzBuzz/FizzBuzz.cs @@ -6,7 +6,25 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + for (int i = 1; i <= 100; i++) + { + if (i % 3 == 0 && i % 5 == 0) + { + Console.WriteLine("FizzBuzz"); + } + else if (i % 3 == 0) + { + Console.WriteLine("Fizz"); + } + else if (i % 5 == 0) + { + Console.WriteLine("Buzz"); + } + else + { + Console.WriteLine(i); + } + } } } } diff --git a/sort/.vscode/launch.json b/sort/.vscode/launch.json new file mode 100644 index 00000000..d047266f --- /dev/null +++ b/sort/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/sort.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ,] +} \ No newline at end of file diff --git a/sort/.vscode/tasks.json b/sort/.vscode/tasks.json new file mode 100644 index 00000000..e51bae53 --- /dev/null +++ b/sort/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/sort.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/sort/Program.cs b/sort/Program.cs new file mode 100644 index 00000000..38a1fe16 --- /dev/null +++ b/sort/Program.cs @@ -0,0 +1,15 @@ +using System; + +namespace sort +{ + class Program + { + static void Main(string[] args) + { + int[] numbers = new int[] { 2, 7, 4, 11, 55, 88, 15, 30, 588, 362 }; + + for (int i = 0;) + //Sort Lowest to Highest + } + } +} diff --git a/sort/sort.csproj b/sort/sort.csproj new file mode 100644 index 00000000..21dff5ca --- /dev/null +++ b/sort/sort.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.2 + + + From 85944b431621eb149f48373fc01aa3888f61bf8c Mon Sep 17 00:00:00 2001 From: Sam Mangum-Bostick Date: Sun, 27 Jan 2019 17:53:18 -0600 Subject: [PATCH 2/3] added loop --- sort/Program.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sort/Program.cs b/sort/Program.cs index 38a1fe16..0e3fb5f2 100644 --- a/sort/Program.cs +++ b/sort/Program.cs @@ -6,9 +6,14 @@ class Program { static void Main(string[] args) { - int[] numbers = new int[] { 2, 7, 4, 11, 55, 88, 15, 30, 588, 362 }; + int[] numbers = new int[] + { + 2, 7, 4, 11, 55, 88, 15, 30, 588, 362 + }; + for (int i = 0; i < numbers.Length; i++) + { - for (int i = 0;) + } //Sort Lowest to Highest } } From a98c778d1d09d60d4d8a383986e5f5074fe1dd28 Mon Sep 17 00:00:00 2001 From: Sam Mangum-Bostick Date: Wed, 30 Jan 2019 11:58:17 -0600 Subject: [PATCH 3/3] Enter values for array and sorts lowest to highest --- sort/Program.cs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/sort/Program.cs b/sort/Program.cs index 0e3fb5f2..cc3cf47c 100644 --- a/sort/Program.cs +++ b/sort/Program.cs @@ -6,13 +6,34 @@ class Program { static void Main(string[] args) { - int[] numbers = new int[] + int i; + int[] a = new int[30]; + Console.Write("Enter the Number of values to be Sort : "); + // read the string value and convert it in to integer + int n = Convert.ToInt16(Console.ReadLine()); + //Reading the values one by one + for (i = 1; i <= n; i++) { - 2, 7, 4, 11, 55, 88, 15, 30, 588, 362 - }; - for (int i = 0; i < numbers.Length; i++) + Console.Write("Enter the No " + i + ":"); + // read the string value and convert it in to integer + a[i] = Convert.ToInt16(Console.ReadLine()); + } + for (i = 1; i <= n; i++) { - + for (int j = 1; j <= n - 1; j++) + { + if (a[j] > a[j + 1]) + { + int temp = a[j]; + a[j] = a[j + 1]; + a[j + 1] = temp; + } + } + } + Console.Write("Ascending Sort : "); + for (i = 1; i <= n; i++) + { + Console.Write(a[i] + " "); } //Sort Lowest to Highest }