Introduction to C# - slide 34 : 43 |
Option Strict On Option Explicit On Module ArrayDemo Sub Main() Dim table(9) as Integer ' indexing from 0 to 9. For i as Integer = 0 To 9 table(i) = i * i Next For i as Integer = 0 To 9 Console.WriteLine(table(i)) Next End Sub End Module
using System; class ArrayDemo{ public static void Main(){ int[] table = new int[10]; // indexing from 0 to 9 for(int i = 0; i <= 9; i++) table[i] = i * i; for(int i = 0; i <= 9; i++) Console.WriteLine(table[i]); } }