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
32 changes: 32 additions & 0 deletions C#/20.Factorial Digit Sum/frangiz.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Numerics;
using System.Linq;

namespace FactorialDigitSum
{
public class MainClass
{
public static void Main()
{
BigInteger number = factorial(new BigInteger(100));

int ans = 0;
foreach (char c in number.ToString())
{
ans += c - '0';
}
Console.WriteLine(ans);
}

private static BigInteger factorial(BigInteger n)
{
BigInteger res = new BigInteger(1);
while (n > 1)
{
res *= n;
n -= 1;
}
return res;
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Happy Contributing! 😃
| 17 | [Number letter counts](https://projecteuler.net/problem=17) | | | | :white_check_mark: | | | | | | | | |
| 18 | [Maximum path sum I](https://projecteuler.net/problem=18) | | | | :white_check_mark: | | | | | | | | |
| 19 | [Counting Sundays](https://projecteuler.net/problem=19) | | | | | | | | | | | | |
| 20 | [Factorial digit sum](https://projecteuler.net/problem=20) | | :white_check_mark: | | :white_check_mark: | :white_check_mark: | | | | | | | |
| 20 | [Factorial digit sum](https://projecteuler.net/problem=20) | | :white_check_mark: | | :white_check_mark: | :white_check_mark: | | | :white_check_mark: | | | | |
| 21 | [Amicable numbers](https://projecteuler.net/problem=21) | | | | | | | | | | | | |
| 22 | [Names scores](https://projecteuler.net/problem=22) | | | | :white_check_mark: | | | | | | | | |
| 23 | [Non-abundant sums](https://projecteuler.net/problem=23) | | | | | | | | | | | | |
Expand Down