Untitled

mail@pastecode.io avatar
unknown
csharp
7 months ago
771 B
4
Indexable
Never
using System;

while (true)
{
    string inp = Console.ReadLine();
    if (inp == "")
    {
        break;
    }
    ulong inpp = ulong.Parse(inp);
    ulong count = 0;
    ulong outs = 1;

    for (ulong i = 2; i <= inpp; i++)
    {
        outs = outs * i;
        ulong nownumber = 2;
        ulong tempi = i;
        while (nownumber <= i)
        {

            if (tempi % nownumber == 0 && tempi != 0 && tempi >= nownumber)
            {
                tempi = tempi / nownumber;
                count++;
            }
            else
            {
                nownumber++;
            }
        }
    }
    int outsa = outs.ToString().ToList().ConvertAll(x => int.Parse(x.ToString())).Sum();
    Console.WriteLine(outs + "\n" + outsa + "\n" + count);
    
}
Leave a Comment