-
foreach 문 array문c# 2016. 7. 8. 21:38
foreach 문 array문
using System; namespace ArrayApplication { class MyArray { static void Main(string[] args) { int [] n = new int[10]; /* n is an array of 10 integers */ /* initialize elements of array n */ for ( int i = 0; i < 10; i++ ) { n[i] = i + 100; } /* output each array element's value */ foreach (int j in n ) { int i = j-100; Console.WriteLine("Element[{0}] = {1}", i, j); } Console.ReadKey(); } } }
'c#' 카테고리의 다른 글
oralce oledb provider (0) 2016.08.11 페이스북에 글 등록하기 (0) 2016.07.11 Miscillaneous Operators (0) 2016.07.08 오라클 연동 (0) 2016.06.29 c# day2 (0) 2016.06.28