1
int N = 2345;
var digitArray = N.ToString().ToCharArray();
int multiplicationSum = 1;
foreach (char digit in digitArray)
{
multiplicationSum = int.Parse(digit.ToString()) * multiplicationSum;
}
var sum = 0;
var sumArray = multiplicationSum.ToString().ToCharArray();
foreach (char digit in sumArray)
{
sum = int.Parse(digit.ToString()) + sum;
}
'var x = N%10'。 – Corak