0

Help please I am trying to output a value of an array, for example I want to output 7. How do I do it? Here's the code:

{
	class Program
	{
		public static void Main(string[] args)
		{
			double [] kush = new double [2] {5.2,7};
			
			Console.WriteLine(kush[2]);
			
			
			
			
			Console.ReadKey(true);
		}
	}
}

I can't seem to get this working, what is my mistake ???

Edited by king03: n/a

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by king03
0

Arrays are numbered from zero up, so your line 6 creates an array with elements [0] and [1].

That should be enough for you to fix your problem.

0

Arrays are numbered from zero up, so your line 6 creates an array with elements [0] and [1].

That should be enough for you to fix your problem.

oh thanks and sorry for such a stupid question I thought I need to add an additional syntax for it but, oh well thank you very much!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.