Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Katas.Session.01/Katas.Session.01/EvenOddKata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static class EvenOddKata
/// <exception cref="NotImplementedException"></exception>
public static string EvenOrOdd(int input)
{
throw new NotImplementedException();
// On regarde si la valeur l'entrée est divisible par 2.
return input % 2 == 0 ? "Even" : "Odd";
}
}
9 changes: 8 additions & 1 deletion Katas.Session.01/Katas.Session.01/MinMaxKata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace Katas.Session._01;

Expand All @@ -14,6 +16,11 @@ public static class MinMaxKata
/// <exception cref="NotImplementedException"></exception>
public static string ComputeMinMax(string input)
{
throw new NotImplementedException();
List<int> intList = [];

foreach (string item in input.Split(' '))
intList.Add(int.Parse(item));

return $"{intList.Max()} {intList.Min()}";
}
}
10 changes: 9 additions & 1 deletion Katas.Session.01/Katas.Session.01/MultipleKata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ public static class MultipleKata
/// <exception cref="NotImplementedException"></exception>
public static int SumMultiplesBelow(int input)
{
throw new NotImplementedException();
int output = 0;

for (int i = 3; i < input; i++)
{
if (i % 3 == 0 || i % 5 == 0)
output += i;
}

return output > 0 ? output : 0;
}
}
4 changes: 3 additions & 1 deletion Katas.Session.01/Katas.Session.01/ReverseStringKata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace Katas.Session._01;

Expand All @@ -12,6 +14,6 @@ public static class ReverseStringKata
/// <exception cref="NotImplementedException"></exception>
public static string ReverseWords(string input)
{
throw new NotImplementedException();
return String.Join(" ", input.Split(' ').Reverse());
}
}
10 changes: 9 additions & 1 deletion Katas.Session.01/Katas.Session.01/VowelsKata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;

namespace Katas.Session._01;

Expand All @@ -13,7 +14,14 @@ public static class VowelsKata
/// <exception cref="NotImplementedException"></exception>
public static int CountVowels(string input)
{
throw new NotImplementedException();
int output = 0;
HashSet<char> voyelles = ['a', 'e', 'i', 'o', 'u'];

for (int i = 0; i < input.Length; i++)
if (voyelles.Contains(input[i]))
output++;

return output;
}
}