This commit is contained in:
@ -2,5 +2,64 @@ namespace Iteration;
|
||||
|
||||
public class Iterations
|
||||
{
|
||||
|
||||
public static int Reverseint(int n)
|
||||
{
|
||||
int result = 0;
|
||||
if (n > 4)
|
||||
{
|
||||
for (int i = 0; i <= n; i++)
|
||||
{
|
||||
result = result * 10 + n % 10;
|
||||
n /= 10;
|
||||
}
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
return result * 10 + n;
|
||||
}
|
||||
}
|
||||
else if (n < 4)
|
||||
{
|
||||
for (int i = 0; i >= n; i--)
|
||||
{
|
||||
result = result * 10 + n % 10;
|
||||
n /= 10;
|
||||
}
|
||||
|
||||
if (n == -1)
|
||||
{
|
||||
return result * 10 + n;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return n;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool FindSub(string s, string sub)
|
||||
{
|
||||
if (sub == "")
|
||||
{
|
||||
throw new ArgumentException("sub cannot be empty");
|
||||
}
|
||||
string phrase = s;
|
||||
string[] word = s.Split(' ');
|
||||
foreach (var mot in word)
|
||||
{
|
||||
if (mot == sub)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool FirstUpper(string s, string sub)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
Console.WriteLine();
|
Reference in New Issue
Block a user