• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C# Pasting array of words and most common letter of them

Denis

New Coder
I should make console application in which we have input of a number of rows with one word on each. Of these words I have to find the most common letter and if there is a number in some of the strings, the program should show the greatest one. But if there is not a number, don't show a result for the number.

This is what I have:

C#:
class Program

    {

        private static object user_string;



        static void readString()

        {



        }

        static void Main(string[] args)

        {

            int arr = Convert.ToInt32(Console.ReadLine());

            string[] rows = new string[arr];





            for (int no = 0; no < rows.Length; no++)

            {

                rows[no] = Console.ReadLine();

            }





            for (int no = 0; no < rows.Length; no++)

            {

                Console.WriteLine(rows[no]);

                Console.WriteLine(rows[no].Length);

            }
 
Last edited by a moderator:

roxanefabin786

New Coder
C# array a collection of objects or types. C# array elements can be of any type, including other array types. An array can be Single-Dimensional, Multidimensional, or Jagged.

In C#, an array index starts at zero. That means the first item of an array starts at the 0th position. The position of the last item on an array will the total number of items - 1. So if an array has 10 items, the last 10th item is in 9th position.

In C#, arrays can be declared as fixed-length or dynamic. A fixed-length array can store a predefined number of items. A dynamic array does not have a predefined size. The size of a dynamic array increases as you add new items to the array. You can declare an array of fixed length or dynamic. You can even change a dynamic array to static after it is defined.

Let's take a look at simple declarations of arrays in C#. The following code snippet defines the simplest dynamic array of integer types that do not have a fixed size.
int[] intArray;

As you can see from the above code snippet, the declaration of an array starts with a type of array followed by a square bracket ([]) and the name of the array.
The following code snippet declares an array that can store 5 items only starting from index 0 to 4.

  1. int[] intArray;
  2. intArray = new int[5];
The following code snippet declares an array that can store 100 items starting from index 0 to 99.

  1. int[] intArray;
  2. intArray = new int[100];
 

Top