Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Counting the integers frequences in an array entered by the user

array frequence

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 AndreMarques

AndreMarques

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 27 November 2017 - 06:48 AM


Question is really easy but I do not know how to continue the code.

 

I want just to count how many times the integers were entered, my code bellow:

 

 

            int number;

          
 
            Console.Write("Input the number of elements to be stored in the array: ");
            number = int.Parse(Console.ReadLine());
 
            Console.WriteLine("Input {0} elements in the array:", number);
            int[] arr = new int[number];
           
           
            for (int i = 0; i < arr.Length; i++)
            {
                arr[i] = int.Parse(Console.ReadLine());
            }
 
            for (int j = 0; j < arr.Length; j++)
            {
                int i = j + 0;
                Console.WriteLine("Element - {0} : {1} ", j, arr[i]);
            }
 
           
                Console.ReadLine();
        
           

 






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download