Created
June 26, 2018 14:00
-
-
Save JL-Cox/a230e20245055fd2298c29e2cf8ad75d to your computer and use it in GitHub Desktop.
CodeWarsKata: Factorial Decomposition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CodeWarsKata_FactorialDecomposition_06262018 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Decomp(6); | |
} | |
public static string Decomp(int n) | |
{ | |
string answer = ""; | |
int[] factorialArr = new int[n]; | |
for (int i = 1; i <= n; i++) | |
{ | |
factorialArr[i - 1] = i; | |
} | |
foreach (var item in factorialArr) | |
{ | |
Console.Write(item); | |
} | |
Console.WriteLine($"Answer: {answer}"); | |
Console.ReadKey(); | |
return answer; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment