This commit is contained in:
nik
2025-09-30 14:26:54 +03:00
parent 8bd93df2ae
commit 8164e04835
633 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,44 @@
class Utils
{
public static int Greater(int a, int b)
{
if (a > b)
return a;
else
return b;
}
public static void Swap(ref int a, ref int b)
{
int temp = a;
a = b;
b = temp;
}
public static bool Factorial(int n, out int answer)
{
int k;
int f = 1;
bool ok = true;
try
{
checked
{
for (k = 2; k <= n; ++k)
{
f = f * k;
}
}
}
catch (Exception)
{
f = 0;
ok = false;
}
answer = f;
return ok;
}
}