Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8187641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:37:50+00:00 2026-06-07T02:37:50+00:00

I have this working almost as intended. The program it self is functional but

  • 0

I have this working almost as intended. The program it self is functional but the output is kinda screwy. It requires multiple hits of of the return key in order to display the contents of the array which is in a for loop and being called by the output() method.

=( seems like a simple enough thing but I am not seeing my problem.

My second issue is the fact that I call output(arr) ONCE but the output prints multiple instances of the array based on the size of the array….

class Program
{
    static void Main(string[] args)
    {
        int value;

        Console.Write("How big of an Array? ");
        int arraySize = int.Parse(Console.ReadLine());
        int[] arr = new int[arraySize];


        for (int i = 0; i <= arraySize - 1; i++)
        {
            Console.Write("First Value: ");
            value = int.Parse(Console.ReadLine());
            arr[i] = Convert.ToInt32(value);
        }

        output(arr);
        Console.ReadLine();
    }

    static void output(Array arr)
    {

        foreach (int i in arr)
        {
            for (int v = 0; v < arr.Length; v++)
            {
                string number = "Value: ";
                string arrayPoint = "Array Section: ";

                Console.WriteLine("{0}{1}\t{2}{3}", arrayPoint, v, number, i);

            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:37:52+00:00Added an answer on June 7, 2026 at 2:37 am

    Couple of things in your code,

    Your output method is receiving parameter of type Array, instead it should be receiving int[], and you should loop it once, not twice.

    static void output(int[] arr)
            {
                    for (int v = 0; v < arr.Length; v++)
                    {
                        string number = "Value: ";
                        string arrayPoint = "Array Section: ";
    
                        Console.WriteLine("{0}{1}\t{2}{3}", arrayPoint, v, number, arr[v]);
                    }
            }
    

    2nd, in your Main method you are using the prompt Enter First Value, which is somewhat confusing when the user is suppose to enter the value for the 2nd or later elements, you may change it to:

        for (int i = 0; i <= arraySize - 1; i++)
        {
            Console.Write(string.Format("Value for Element {0}: ",i));
            value = int.Parse(Console.ReadLine());
            //arr[i] = int.Parse(Console.ReadLine()); // or you can do
            arr[i] = value;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this working but it requires me to have a static method
I have this working great, but I'd like a deeper understanding of what is
I have this working code, but now i need to be able to change
I think I have this working but I need advice. I'd like to know
I have this regex working but now need to allow numbers without the decimal
I have this query working but it is not returning back exactly what I
I have this working ok(ish) in my game at the moment, but i'm not
I almost have this working however the script is rounding my numbers while I
I have Google this question for almost a whole day, but still not answer.
So I have this demo project almost completely working. public class Project { public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.