Horje
c# prime factorization Code Example
c# prime factorization
class Program
{
    static void Main(string[] args)
    {
        int a, b;
        Console.WriteLine("Please enter your integer: ");
        a = int.Parse(Console.ReadLine());
        for (b = 1; b <= a; b++)
        {
            if (a % b == 0)
            {
                Console.WriteLine(b + " is a factor of " + a);
            }
        }
    }
}
c# prime factorization

int a, b;
Console.WriteLine("Please enter your integer: ");
a = int.Parse(Console.ReadLine());

for (b = 2; a > 1; b++)
    if (a % b == 0)
    {
        int x = 0;
        while (a % b == 0)
        {
            a /= b;
            x++;
        }
        Console.WriteLine($"{b} is a prime factor {x} times!");
    }
Console.WriteLine("Th-Th-Th-Th-Th-... That's all, folks!");





Csharp

Related
c# replace crlf Code Example c# replace crlf Code Example
remove all non number in c# Code Example remove all non number in c# Code Example
check for collision unity c# Code Example check for collision unity c# Code Example
create a slider in the inspector C# Code Example create a slider in the inspector C# Code Example
random.range unity Code Example random.range unity Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13