diff --git a/FizzBuzz/FizzBuzz.cs b/FizzBuzz/FizzBuzz.cs index 9246f703..28966e87 100644 --- a/FizzBuzz/FizzBuzz.cs +++ b/FizzBuzz/FizzBuzz.cs @@ -6,7 +6,29 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + for (int i = 1; i <= 100; i++) + { + //Checks if divisible by 3 and 5 + if (i % 3 == 0 && i % 5 == 0) + { + Console.WriteLine("FizzBuzz"); + } + //Checks if divisible by 3 + else if (i % 3 == 0) + { + Console.WriteLine("Fizz"); + } + //Checks if divisible by 5 + else if (i % 5 == 0) + { + Console.WriteLine("Buzz"); + } + //If neither print number + else + { + Console.WriteLine(i); + } + } } } } diff --git a/HelloWorld/.vscode/launch.json b/HelloWorld/.vscode/launch.json new file mode 100644 index 00000000..95d8af5c --- /dev/null +++ b/HelloWorld/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/HelloWorld.dll", + "args": [], + "cwd": "${workspaceFolder}", + "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/HelloWorld/.vscode/tasks.json b/HelloWorld/.vscode/tasks.json new file mode 100644 index 00000000..7cf275a8 --- /dev/null +++ b/HelloWorld/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/HelloWorld.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/HelloWorld/HelloWorld.cs b/HelloWorld/HelloWorld.cs index 8168c805..3a382d3c 100644 --- a/HelloWorld/HelloWorld.cs +++ b/HelloWorld/HelloWorld.cs @@ -6,7 +6,11 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + Console.WriteLine("Hello Sam!"); + string yourName = Console.ReadLine(); + Console.Write("Hello "); + Console.Write(yourName); } } + }