static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] a = new int[n]; int flag = 0; for (int i = 0; i < n; i++) { a[i] = int.Parse(Console.ReadLine()); if (a[i] > 500) { flag = 1; } } if (flag == 1) { Console.WriteLine("Array element greater than 500"); Environment.Exit(0); } int[] res = UserProgramCode.getAllElement(a); for (int i = 0; i < res.Length & res[i] != 0; i++) { Console.WriteLine(res[i]); } }
static void Main(string[] args) { string s = Console.ReadLine(); char a = char.Parse(Console.ReadLine()); int x = UserProgramCode.FindOccurance(s, a); if (x == -1) { Console.WriteLine("Invalid Input"); } else { Console.WriteLine(x); } }