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..cc3cf47c --- /dev/null +++ b/sort/Program.cs @@ -0,0 +1,41 @@ +using System; + +namespace sort +{ + class Program + { + static void Main(string[] args) + { + 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++) + { + 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 + } + } +} 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 + + +