C# user input int to array

前端 未结 4 1347
难免孤独
难免孤独 2021-01-14 23:35

I\'m asking the user to input 5 numbers and store it into an array so I can send the values in a method and subtract 5 numbers from each array. When I use the:



        
4条回答
  •  抹茶落季
    2021-01-15 00:03

    You initialize the array first

    int[] val = new int[5];
    

    and then when you do a for loop:

    for (int i=0; i

    Hint: To send the array values from main to the method, just look at how static void main is formed:

    static void Main(string[] args)
    

    Meaning main is accepting a string array of of console arguments.

提交回复
热议问题