public static void Main()
Console.WriteLine("Question number 21.");
Console.WriteLine(TestNum21(19, 26));
Console.WriteLine(TestNum21(24, 25));
Console.WriteLine(TestNum21(19, 31));
Console.WriteLine("Question number 22.");
Console.WriteLine(TestNum22("zazzy"));
Console.WriteLine(TestNum22("colin"));
Console.WriteLine(TestNum22("wozzozzers"));
Console.WriteLine("Question number 23.");
Console.WriteLine(TestNum23(19, 29));
Console.WriteLine(TestNum23(24, 25));
Console.WriteLine(TestNum23(19, 31));
Console.WriteLine("Question number 24.");
Console.WriteLine(TestNum24("zy"));
Console.WriteLine(TestNum24("lin"));
Console.WriteLine(TestNum24("wozzozzers"));
Console.WriteLine("Question number 25.");
Console.WriteLine(TestNum25("Colin", 4));
Console.WriteLine(TestNum25("Colin", 1));
Console.WriteLine(TestNum25("Colin", 2));
Console.WriteLine("Question number 26.");
Console.WriteLine(TestNum26("Colin", 4));
Console.WriteLine(TestNum26("Colin", 1));
Console.WriteLine(TestNum26("Co", 2));
Console.WriteLine("Question number 27.");
Console.WriteLine(TestNum27("aapple"));
Console.WriteLine(TestNum27("waaa waaa"));
public static int TestNum21(int x, int y)
return (x >= 20 && x <= 30) || (y >= 20 && y <= 30) ? ((x >= 20 && x <= 30) && (y >= 20 && y <= 30) ? Math.Max(x, y) : ((x >= 20 && x <= 30) ? x : y)) : 0;
public static string TestNum22(string str)
for (int i = 0; i < str.Length; i++)
return $"{str} - # of Z's: {ctr}";
public static bool TestNum23(int x, int y)
string strX = x.ToString();
string strY = y.ToString();
return strX[strX.Length - 1] == strY[strY.Length - 1];
public static string TestNum24(string str)
return str.Length < 3 ? str.ToUpper() : str.Substring(0, str.Length - 3) + str.Substring(str.Length - 3, 3).ToUpper();
public static string TestNum25(string str, int n)
string result = string.Empty;
for (int i = 0; i < n; i++)
public static string TestNum26(string str, int n)
string result = string.Empty;
for (int i = 0; i < n; i++)
for (int i = 0; i < n; i++)
result += str.Substring(0, 3);
public static int TestNum27(string str)
for (int i = 0; i < str.Length - 1; i++)
if (str.Substring(i, 2) == "aa")